Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with the syntax 1

Status
Not open for further replies.

rogers42

Technical User
Mar 30, 2007
64
CA
Contents of Data File:
123-2009-123-123
456-2008-123-0
789-2009-100-0

awk Code:

BEGIN {
# Set the field seprator
FS="-";
}

/2009/
{
print "Updating " $2 " data";
}
}

Output:

All lines are printed

I am executing my script as follows

cat test.dat | nawk -f update.awk

Can somebody please let me know where I am going wrong ?

Thanks in advance

rogers42
 
You have an extra }
Code:
/2009/{
  print "Updating " $2 " data"
}
Code:
nawk -F- -f update.awk test.dat

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top