I am trying to filter a .tsv file by selected relevant rows. I had done this a few days ago with the same file, and had had no problems. However today, as I was filtering the file I had the error as below: awk: syntax error at source line 1 context is >>> /Users/rbs/Desktop/results.e <<< ntries.tsv awk: bailing out at source line 1
Here is the code I had written into my terminal. awk -F '{ if ($5 == 20004 || $5 == 41200) print $0; }' ~/Desktop/results.entries.tsv > ~/filtered2.tsv
Other details: I am using Mac OSX
I apologise if the question is unclear - I am a beginner!
CodePudding user response:
You did not include the field separator for the option -F
.
Try for a CSV:
awk -F ',' '{ if ($5 == 20004 || $5 == 41200) print $0; }' ~/Desktop/results.entries.tsv > ~/filtered2.tsv