![]() |
|
|
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 |
| awk print the next line on the current line | ajp7701 | Shell Programming and Scripting | 5 | 05-25-2009 01:17 PM |
| awk to print current date? | philipz | UNIX for Dummies Questions & Answers | 3 | 09-02-2008 04:58 PM |
| how to go previous line in vim | useless79 | UNIX for Advanced & Expert Users | 2 | 09-16-2007 09:10 AM |
| How to print current month - 1 in string format | mogli4 | Shell Programming and Scripting | 3 | 03-10-2006 04:47 PM |
| may be simple but i don't know -- Print current date from C program | ls1429 | High Level Programming | 6 | 02-19-2002 01:50 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Print previous, current and next line using sed
Hi,
how can i print the previous, current and next line using sed? current line is the matching line. The following prints all lines containing 'Failure' and also the immediate next line cat $file | sed -n -e '/Failure/{N;p;}' Now, i also want to print the previous line too. Thanks, -srinivas yelamanchili |
|
||||
|
Thanks to all for the solution.
-A, B, C options are not supported. Using HP-UX 11.11 Now, can i print just the previous line and the matching line? cat replace_all* | sed -n -e 'N;/Failure/p;' prints the previous line only for the first match, thereafter only matching lines are printed and not their previous lines. Thanks, -srinivas |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|