LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Deleting those lines that doent have 3rd field (http://www.linuxquestions.org/questions/programming-9/deleting-those-lines-that-doent-have-3rd-field-665684/)

raghu123 08-27-2008 01:46 AM

Deleting those lines that doent have 3rd field
 
Hi....i have a file like this....
1 1A4G:A 1A4G:B:97
1 1A4G:A 1A4G:A:97
1 1A4G:A 3CKZ:A:53
1 1A4G:A
1 1A4G:A
2 1A4G:B 1A4G:B:97
2 1A4G:B 1A4G:A:97
2 1A4G:B 3CKZ:A:53
2 1A4G:B
2 1A4G:B
3 1CT1:F 1CT1:G:100
3 1CT1:F 1CT1:F:100
so on....

I want to delete those lines which doesnt have the 3rd field or arguement...For eg.. in the 4th and 5th lines, the 3rd field is absent...so i want to delete these lines.....

Plz suggest.....

Mr. C. 08-27-2008 01:54 AM

Think about awk and the NF variable.

ghostdog74 08-27-2008 03:20 AM

@OP: Put in some effort

raghu123 08-28-2008 11:35 PM

Yup........I did it using the NF variable


All times are GMT -5. The time now is 07:07 AM.