• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1017
  • Last Modified:

awk question

perhaps its friday but i cannot see why this little devil is eluding me.  i have a log file that gives an error code in column three. we look at the file and have to type msg xxx to get the appropriate narrative. i thought i would just write a script to give me the errors and then do a msg for each one it found. this is what i started but not sure what is eluding me.  please advise.

for i in `awk {print $3} log`
  do
     msg $i
   done  

thanks,
banba

here is the error msg:
Syntax Error The source line is 1.
 The error context is
                 >>> {print <<<
 awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.  


here is the sample (i am after the x,x,x errors)

2000/09/07 00:11:57.591 80,0,55 <fnsw> bes_commit (17802) ... [WARNING]
DOC: Doc migration requested on Server (id=2) which has no Storage Libraries

2000/09/07 00:12:13.272 80,0,55 <fnsw> BESs (44898) ... [WARNING]
DOC: Doc migration requested on Server (id=2) which has no Storage Libraries

2000/09/07 08:33:48.870 90,0,19 <fnsw> INXs (29930) ...
INXl_validate: error on doc_id 119925                        
0
banba
Asked:
banba
  • 4
1 Solution
 
biraCommented:
Hi

  May you post piece of your log file, and
  the result yor are getting
0
 
biraCommented:
Or try

 for i in `cat log | awk {print $3)`
 do
    msg $i
  done  
0
 
biraCommented:
Or

 for i in `cat log | awk {'print $3')`
do
   msg $i
 done  
0
 
biraCommented:
Dear banba

  Now it is tested ok and works fine. forget the previous,
 because they have some syntax problem.
 


for i in `awk '{print $3}' log`
do
msg $i
done


   Regards
0
 
banbaAuthor Commented:
thanks so much, as i drove home bleary eyed on friday, i wondered if it was due to an errant tic mark. it works just fine!

best regards,
banba
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now