![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| UNIX for beginners | jmy113437 | UNIX Desktop for Dummies Questions & Answers | 14 | 05-26-2008 11:55 AM |
| recommended books for beginners | briant | UNIX for Dummies Questions & Answers | 2 | 09-17-2007 09:57 PM |
| 'Best' AIX book for beginners ? | vilius | AIX | 1 | 08-25-2007 02:05 AM |
| unix course for beginners | moose | UNIX Desktop for Dummies Questions & Answers | 1 | 04-15-2002 05:50 PM |
| X-programming for beginners | jfsuminist | High Level Programming | 1 | 08-19-2001 10:38 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
awk - Beginners Question
I have my inputfile in the following format :
From:sdhfhg dsfhsdjfjdsfh dsfjdjshjsd djfhsdjfjsdhjds Error Description <aa.aa.aa.aa.aa.aa> From:ksljfsdhfjh djfdsjkf sdjwoquk dsfsdfj Error Description <dd.dd.dd.dd.dd> I want to read the lines from tag 'From:' thrul <aa.aa.aa.aa.aa.aa> similarly for the next block. Next I want to read the Error Description and assign an codenumber to it. I am using the following code : Code:
#this is my first awk program
BEGIN {errorcode=0}
/From/ {take actions}
#Read until next 'From'
{while!(^/<[a-z]/)
if (/ErrorDesc1/) print "01"
else if(/ErrorDesc2/) print "02"
else if(/ErrorDesc3l/) print "03"}
{if(errorcode != 01 && errorcode != 02 && errorcode != 03) print "04"}
The error context is >>> {while! <<< (^/<[a-z]) awk: The statement cannot be correctly parsed. The source line is 13. Can someone guide...I am new to awk programming. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|