I am trying to output all lines in a file where $7 is less than 30. The below code does create a result file, but with all lines in the original file. The original file is tab deliminated is that the problem? Thank you :).
awk 'BEGIN{FS=OFS=","} $7 < 30 {print}' file.txt > result.txt
file.txt
chr1 40539722 40539865 chr1:40539722-40539865 PPT1 1 159
chr1 40539722 40539865 chr1:40539722-40539865 PPT1 2 161
chr1 40539722 40539865 chr1:40539722-40539865 PPT1 3 161
chr1 40539722 40539865 chr1:40539722-40539865 PPT1 3 28
Desired result.txt
chr1 40539722 40539865 chr1:40539722-40539865 PPT1 3 28
---------- Post updated at 12:12 PM ---------- Previous update was at 11:59 AM ----------
It was the FS=OFS="',"
.... should be OFS="/t"
, guess I need to pay more attention. FS is Field seperator and OFS is Output Field Seperator, right? Thank you :).