![]() |
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 |
| Major OS errors/Bash errors help!!!! | wcmmlynn | UNIX for Dummies Questions & Answers | 12 | 11-13-2007 04:50 AM |
| Adapter Errors and Link Errors | mcastill66 | AIX | 2 | 08-02-2005 06:51 PM |
| Adapter Errors and Link Errors | mcastill66 | UNIX for Advanced & Expert Users | 0 | 08-02-2005 06:11 PM |
| errors | nobody | HP-UX | 1 | 12-14-2003 10:08 AM |
| Help with errors | Phaedirean | Filesystems, Disks and Memory | 5 | 08-12-2003 02:02 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
awk errors
Hello,
Can you please let me know how to find all lines that don't begin with pattern1, pattern2, pattern3 and pattern4? Here is my awk script that gives an error. awk 'BEGIN { NAME="$FILE" GSNO=0 } /^ISA/ { FIRST=$0; LAST="IEA*1*" + "substr($0,90,9}" } /^GS/ { GSNO=++; NAME="$FILE"$GSNO; print "$FIRST" >> $NAME; print $0 >> $NAME} [/!^ISA/[,/!^GS/[,/!^GE/[,/!^IEA/]]]]{ print $0 >> $NAME } /^GE/ { print $0 >> $NAME; print $LAST >> $NAME } /^IEA/ {} ' $FILE The red part should mean 'if it does not begins with ISA, GS, GE, IEA. I don't know the syntax. Thanks. |
|
||||
|
OK, this is what I want.
There is a file like this: ISAtext1 GStext2 text3 text4 ... textn GE IEA I want to do this: if line begins ISA - do command1. if line begins GS -do command2. all other lines (means all except ISA, GS, GE, IEA) - do command3. - how to write this in awk??? if line begins GE - do commad4 if line begins IEA -do command5. Hope I was more clear. Thanks |
|
||||
|
Thank you very much Igor.
It works! ![]() |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|