![]() |
|
|
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 |
| Problem with csh script | rahulrathod | Shell Programming and Scripting | 4 | 02-21-2008 12:38 PM |
| script problem | tdavenpo | Shell Programming and Scripting | 3 | 01-04-2006 04:07 PM |
| Problem starting a script from a 'main'-script | Rakker | UNIX for Dummies Questions & Answers | 3 | 06-28-2005 09:12 AM |
| problem with a script | Lestat | Shell Programming and Scripting | 4 | 06-13-2005 01:30 PM |
| problem with ftp script...please help | vancouver_joe | UNIX for Advanced & Expert Users | 2 | 11-22-2001 07:47 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
awk script Problem
I wrote a awk but doesnt work as expected.
The Input File attached input file My awk Script /^......[^*].*EXEC CICS /,/END-EXEC/ { if ( $0 ~ / LINK / ) { tsflag=1 } if ( $0 ~ /EXEC CICS/ && tsflag == 1 ) {print "This is Before EXEC CICS"} if( $0 ~ /END-EXEC/ && tsflag ==1 ) { print "This is After END-EXEC" } }; I wanted to Insert a line before EXEC CICS and One After END-EXEC if it has a word LINK in it But the Out put comes as follows attached Otput The After Print is fine but the Before One also comes after the EXEC CICS{ I didnt know how to put if before } And the Last chunk AAAAAA EXEC CICS AAAAAA ABEND AAAAAA ABCODE ( AB-CODE ) AAAAAA END-EXEC. Matches Even if It Doesnt have LINK in it (Dont Know Why) Need get 2 things working in this..... 1) TO put the Statement before EXEC CICS 2) Prevent it from adding if it Doesnt Contain LINK Last edited by pbsrinivas; 07-05-2007 at 03:21 AM.. Reason: spaces are getting deleted after posting... |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|