1

Awk Query

view story
linux-howto

http://www.linuxquestions.org – Actually 2 queries - just realised another problem with my code. I have the below file: Code: 1 (local) 10.1.2.3 up 2        10.2.3.4  down I need to detect the last column where the status = down. At first I had this: Quote: cat file | awk '{ if $5 == "down" ) { print "server down" } }' I then realized in the above file the up/down status is not always in the 5th column, but the last column. How can I use awk for this? When that's sorted then in place of printing an error I want to set a variable. I had th (HowTos)