![]() |
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 |
| Pattern matching in Duplicated file and print once | Danish Shakil | Shell Programming and Scripting | 1 | 08-01-2008 03:55 AM |
| Pattern Matching and lines after that | kaushys | Shell Programming and Scripting | 4 | 06-23-2008 11:27 AM |
| pattern matching over more lines | trek | Shell Programming and Scripting | 3 | 04-22-2008 06:37 AM |
| Reading lines in a file matching a pattern | torenji | Shell Programming and Scripting | 4 | 10-25-2007 04:15 AM |
| pattern matching and print with sed | nymus7 | Shell Programming and Scripting | 2 | 04-14-2005 09:36 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Print block of lines matching a pattern
Hi
,I am using the script to search "MYPATTERN" in MYFILE and print that block of lines containing the pattern starting with HEADER upto FOOTER. But my problem is that at some occurrence my footer is different e.g. ";". How to modify the script so that MYPATTERN between HEADER and different footers can be printed and that too without loosing the sequence. gawk -v search='MYPATTERN' ' /HEADER/,/FOOTER/ { block = (block ? block ORS : "") $0; } /FOOTER/ { if (block ~ search) print block; block = ""; } ' <MYFILE> Also, in this script what to modify if I want to print all thing except MYPATTERN blocks. Please help me in solving this problem. Thnx in advance. |
|
||||
|
Dear Friends,
Please help me out of this problem... Quote:
|
| Sponsored Links | ||
|
|