0

I have a file(pdb)like this:

ATOM      1  N   LEU A   2       6.630  12.294  -1.457  1.00  0.00           N  
ATOM      2  CA  LEU A   2       7.613  12.686  -0.404  1.00  0.00           C  
ATOM      8  CD2 LEU A   2       7.005  14.461   2.993  1.00  0.00           C  
ATOM     20  N   SER A   3       9.372  11.018  -0.564  1.00  0.00           N  
ATOM     21  CA  SER A   3      10.112   9.794  -0.130  1.00  0.00           C  
ATOM     22  C   SER A   3       9.128   8.620   0.057  1.00  0.00           C  
ATOM     31  N   PRO A   4       8.542   8.135  -1.026  1.00  0.00           N  
ATOM     32  CA  PRO A   4       7.582   7.018  -0.934  1.00  0.00           C  

I need to take the first line with N atom and skipping the next one and taking the following one: the output matrix will looks like this, How can I do it with awk or other command?

ATOM      1  N   LEU A   2       6.630  12.294  -1.457  1.00  0.00           N  
ATOM     31  N   PRO A   4       8.542   8.135  -1.026  1.00  0.00           N  

Thank you

2

If i understand your requirement correctly it should be as simple as

awk '$3 == "N"{++x; if (x % 2) print}' file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.