![]() |
compare second column of a file then print the first column of it in a ne fil if true
I have this input in my file.txt
213.236.6.230 58 1435 213.236.6.249 24 1532 213.236.9.58 19 67 213.236.10.80 9 1226 213.236.9.193 3 203 I need to compare if 58 > 10, if it is i will save 213.236.6.230 in file2.txt if not go to the next line and so on. Please help. |
Quote:
Code:
awk '{if ($2 > 10) {print $1}}' $InFile > $OutFile |
You can also bypass the "if" as anything outside a pair of {} will be evaluated:
Code:
awk '$2 > 10{print $1}' file > outfile |
| All times are GMT -5. The time now is 03:30 AM. |