Solved

awk question

Posted on 2001-09-07
5
1,012 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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unix / Linux grid computing 5 169
Java core in Solaris 10 1 312
AIX    Volume group Auto ON/OFF question 2 127
reinstall 1 92
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 …
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

733 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