1752826 Members
3989 Online
108789 Solutions
New Discussion юеВ

grep problem

 
Sutapa Dey
Frequent Advisor

grep problem

How to use grep in HP-UX so that I can print 2 lines after the pattren is found?
grep -A 2 command doesnot work in HP-UX
2 REPLIES 2
Steven Schweda
Honored Contributor

Re: grep problem

> grep -A 2 command doesnot work in HP-UX

It might, if you had the right grep program
installed on your HP-UX system.

Where _does_ it work, GNU+Linux? If you like
GNU grep, then it might make sense to use it
on HP-UX, too.

http://www.gnu.org/software/grep/
Sutapa Dey
Frequent Advisor

Re: grep problem

Thanks a lot for the reply but I have solved the problem, the command is

sed -n -e 'N;//p' filename

This wil append the next line after pattern matching.