[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

awk question

Posted on 2001-09-07
5
Medium Priority
?
1,016 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 400 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

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
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.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

649 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