![]() |
|
|
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 |
| How to negate grep result? | mmdawg | Shell Programming and Scripting | 4 | 05-05-2008 09:24 AM |
| diaplaying the grep result | rag84dec | Shell Programming and Scripting | 1 | 03-27-2008 02:37 AM |
| Outputting formatted Result log file from old 30000 lines result log<help required> | vikas.iet | Shell Programming and Scripting | 5 | 12-02-2007 10:43 PM |
| egrep counting every 2 lines of result as 1 | Orbix | UNIX for Dummies Questions & Answers | 1 | 11-20-2007 08:12 PM |
| How can you show lines surrounding a search string? | robster | UNIX for Dummies Questions & Answers | 3 | 06-07-2005 12:33 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
how to get surrounding lines of grep result
hi,
if i have a file and i want to search for the word error using grep, i usually want to see the surrounding lines too as they contain info about the error. what would be a nice way to achieve this? thanks |
|
|||||
|
Hi.
There are awk and perl solutions in the thread grep and display few lines before and after I tried them both and they work. The perl solution is far longer, but more general. An interesting and powerful utility is found at cgrep home page referred to from freshmeat.net: Project details for cgrep but will require some work to configure and compile the c code of the project: Quote:
|
![]() |
| Bookmarks |
| Tags |
| solaris |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|