![]() |
|
|
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 |
| sed remove everything up to the pattern | katrvu | Shell Programming and Scripting | 4 | 04-08-2008 10:35 PM |
| grep required pattern and next 2 or 3 lines | cvvsnm | UNIX for Dummies Questions & Answers | 3 | 02-01-2008 05:20 AM |
| grep to show lines only after pattern | wannalearn | Shell Programming and Scripting | 5 | 10-09-2007 03:44 AM |
| Search file for pattern and grab some lines before pattern | frustrated1 | Shell Programming and Scripting | 2 | 12-22-2005 03:41 PM |
| grep - to exclude lines beginning with pattern | frustrated1 | Shell Programming and Scripting | 2 | 08-29-2005 08:18 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
grep for particular pattern and remove few lines above top and bottom of the pattern
grep for a particular pattern and remove 5 lines above the pattern and 6 lines below the pattern
root@server1 [~]# cat filename Shell Programming and Scripting test1 Shell Programminsada asda dasd asd Shell Programming and Scripting Post New Thread Shell Programming and S sadsa sadcripting Post New Thread Shell Progsdaas dsadsaramming and Scripting Post New Thread Shell Programming and Scripting Post New Thread Shell Programming and Scripting Post New Thread Shell Programming and Scripting Post New Thread Shell Programming and Scripting Post New Thread Shell Programming and Scripting Post New Thread pattern_to_remove Shell Programming and Scripting Post New Thread Shell Programming awetrtg teyy teyer nd Scripting Post New Thread Shell Programming and Scripting Post New Thread Shell Programming and Scripting Post New Thread Shell Programming and rewrwt r t Scripting Post New Thread Shell Programming and Scripting Post New Thread Shell Programmingsadas ade and Scripting Post New Thread Shell Programming and Scripting Post New Thread Shell Programming and Scripting Post New Thread Shell Programminsadsa asdad`g and Scripting Post New Thread Prefix each line of output with the line number within its input file. ####################################################################################### root@server1 [~]# grep -n "pattern_" 12345 12 attern_to_removeroot@server1 [~]# Now I want that 5 lines before line number 12 and 6 lines after line number 12 be replaced with null or removed(deleted) with a script Please advise Last edited by fed.linuxgossip; 02-29-2008 at 12:46 PM.. Reason: spell |
| Bookmarks |
| Tags |
| linux, linux commands, solaris |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|