![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| single line input to multiple line output with sed | mitch | Shell Programming and Scripting | 8 | 07-16-2008 10:57 AM |
| reading ps command's output line by line | s. murat | Shell Programming and Scripting | 5 | 05-22-2008 01:23 AM |
| How to grep / zgrep to output ONLY the matching filename and line number? | vvaidyan | UNIX for Dummies Questions & Answers | 3 | 03-12-2008 01:33 PM |
| Multi-line output to single line | LinuxRacr | Shell Programming and Scripting | 7 | 02-26-2008 06:05 AM |
| need grep to output basename and line# | zoo591 | Shell Programming and Scripting | 18 | 07-16-2005 07:34 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Grep or other ways to output line above and/or below searched line
Hi all,
Would like to know how I could search for a string 'xyz' but have the output show the line plus the line above and/or below all lines found. eg. search for xyz from file containing: abc 12345 asdf xyz asdfds wwwww kjkjkj ppppp kkkxyz eeee zzzzz and the output to show: 12345 asdf xyz asdfds wwwww ppppp kkkxyz eeee option to only show line above or below or x number of lines above or below. preference to use script rather than something like perl... thanks... |
| Forum Sponsor | ||
|
|
|
|||
|
Refer to this recent thread: how to get surrounding lines of grep result
|