You're viewing a comment by Fords and its responses.

Fords Permalink
August 28, 2015, 22:13

I have sample data as below, first column is hostname and second is randdom # 1 14 24 11 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


Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

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

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