2

In awk, I am using / as the field separator. However,there are some records in the input file that do not contain this field separator. How does awk behave for such records? Is there any way to tell awk to skip such records?

Satish
  • 21
  • 1

1 Answers1

2

If there's no field separator on a line, then the line consists of a single field.

If you want to skip lines with a single field, you can start your awk program with

NF == 1 {next}
  • As you're a reputation 6 user: If this answer helped you, don't forget to click the grey at the left of the answer, which means "yes, this answer is valid"! ;-) – A.B. Aug 23 '15 at 15:10
  • @A.B. Your comment was addressed to me, not to the asker. Not that it would have been useful if you'd addressed it correctly, considering that the asker hasn't been on the site for two years. – Gilles 'SO- stop being evil' Aug 23 '15 at 15:43