grep -n5 ^9 filename

steve

-----Original Message-----
From: Eric Clover [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 16, 2000 1:11 PM
To: redhat
Subject: cat <file>|grep <word>|??? <display 5lines before and after the
grep>


hello,
i have a need for something that will cat a large file, grep it for a
word and have the ability to pull the 5 lines before and after (more
like 3 lines before and 8 lines after) the grep has found the word and
display the results. example:

cat <file>|grep 5|??? 2
<file>
1
2
3
4
5
6
7
8
9
10
</file>

output = 3
         4
         5 <-- being the greped word and pulling the 2 lines before and
after
         6
         7

can this be done??

thank you

eric



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to