Skip to main content
1 of 3
Kusalananda
  • 355.9k
  • 42
  • 735
  • 1.1k

The file that you run the script on has DOS line-endings. It may be that it was created on a Windows machine.

Use dos2unix to convert it to a Unix text file.

Alternatively, run it through tr:

tr -d '\r' <input.txt >input-unix.txt

Then use input-unix.txt with your otherwise correct awk code.


To modify the awk code instead of the input file:

 awk -F, '$7 == "-99\r"' input.txt >output.txt

or

 awk -F, '$7 + 0 == -99' input.txt >output.txt
Kusalananda
  • 355.9k
  • 42
  • 735
  • 1.1k