Solved

awk question

Posted on 2001-09-07
5
1,013 Views
Last Modified: 2011-09-20
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
Comment
Question by:banba
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 6

Expert Comment

by:bira
ID: 6465555
Hi

  May you post piece of your log file, and
  the result yor are getting
0
 
LVL 6

Expert Comment

by:bira
ID: 6465566
Or try

 for i in `cat log | awk {print $3)`
 do
    msg $i
  done  
0
 
LVL 6

Expert Comment

by:bira
ID: 6465603
Or

 for i in `cat log | awk {'print $3')`
do
   msg $i
 done  
0
 
LVL 6

Accepted Solution

by:
bira earned 100 total points
ID: 6465686
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
 

Author Comment

by:banba
ID: 6470796
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question