You're replying to a comment by Fords.

Fords Permalink
August 28, 2015, 22:13

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

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "unix_122": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.