I have sample data as below, first column is hostname and second is randdom #
host1.net 1
host2.net 14
host30.net 24
host0.net 11
host9.net 5
I need an awk script to check and validate based on column 2 and print entire line to a separate file if it matches criteria. I also need to change the number for different scripts.
I have below code but is not working as expected, any help would be appreciated.
while read line do if [[ $(awk '$2 == "1"') ]] then echo "$line" >> /var/failed.txt fi done < /var/results.txt
I have sample data as below, first column is hostname and second is randdom #
host1.net 1
host2.net 14
host30.net 24
host0.net 11
host9.net 5
I need an awk script to check and validate based on column 2 and print entire line to a separate file if it matches criteria. I also need to change the number for different scripts.
I have below code but is not working as expected, any help would be appreciated.
while read line do if [[ $(awk '$2 == "1"') ]] then echo "$line" >> /var/failed.txt fi done < /var/results.txt
Thanks
Reply To This Comment