![]() |
|
|
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 |
| Search between pattrens with one string in one or other line........ | pbsrinivas | Shell Programming and Scripting | 12 | 07-02-2007 03:37 AM |
| Search and insert between Pattrens... | pbsrinivas | Shell Programming and Scripting | 7 | 06-11-2007 04:25 AM |
| How to count lines - ignoring blank lines and commented lines | kthatch | UNIX for Dummies Questions & Answers | 6 | 05-25-2007 02:21 AM |
| Search between pattrens. | pbsrinivas | Shell Programming and Scripting | 3 | 05-08-2007 05:34 PM |
| Sed insert and Change lines help needed | JunkYardWars | Shell Programming and Scripting | 2 | 03-24-2006 05:50 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Need to change a set of lines between two given Pattrens
Hi All
I have a Small Requiement I wanted to replace all the Follwing lines as follows Input:: file1 EVALUATE WS-TEMP-ATTR(15:1) WHEN 'D' MOVE DFHDARK TO WS-ATTR-COLOR WHEN OTHER MOVE DFHDFT TO WS-ATTR-COLOR END-EVALUATE. Output::file2 TCSCMT* EVALUATE WS-TEMP-ATTR(5:1) TCSCMT* WHEN 'D' TCSCMT* MOVE DFHDARK TO WS-ATTR-COLOR TCSCMT* WHEN OTHER TCSCMT* MOVE DFHDFT TO WS-ATTR-COLOR TCSCMT* END-EVALUATE. I have Tried Some thing of this sort with sed sedscript File / EVALUATE WS-TEMP-ATTR(5:1)/c\ TCSCMT* EVALUATE WS-TEMP-ATTR(5:1) / WHEN 'D'/c\ TCSCMT* WHEN 'D' / MOVE DFHDFT TO WS-ATTR-COLOR/c\ TCSCMT* MOVE DFHDFT TO WS-ATTR-COLOR / WHEN 'OTHER'/c\ TCSCMT* WHEN 'OTHER' / MOVE DFHDFT TO WS-ATTR-COLOR/c\ TCSCMT* MOVE DFHDFT TO WS-ATTR-COLOR / END-EVALUATE./c\ TCSCMT* END-EVALUATE. sed -f sedscript file1 > file2 I have got what i wanted but....... If i have more than one END-EVALUATE in the file1 the it is replacing everything But i want it to happen only between these two line 1 EVALUATE WS-TEMP-ATTR(5:1) 2 END-EVALUATE So thats it doesn't Effecft others This is basically to comment the Paticular set of lines in the code... |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|