The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: nawk help
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-11-2009
beppler beppler is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 15
nawk help

What am I doing wrong here? I get syntax error.

I am trying to parse a file looking for the lines with "running" as the first field then print the 5th field, then looking at the 9th field for specific values and writing the whole line to a junk file.

nawk ';
{if ($1 == "running") print $1 >> ./junk1;
if ($9 == "S73isid") {print $0} >> ./junk1;
if ($9 == "S750vxpal.gridnode") {print $0} >> ./junk1;
if ($9 == "S75vxpal.StorageAgent") {print $0} >> ./junk1;
if ($9 == "S75vxsmfd") {print $0} >> ./junk1;
if ($9 == "S760vxpal.actionagent") {print $0} >> ./junk1;
print}' rc2.d_listing

Thanks!!