[Ilugc] Grep two lines from text file with different A and B switch

Balasubramaniam Natarajan bala150985 at gmail.com
Thu Jul 26 18:24:23 IST 2012


Hi

I have many text file like so

*Input*
$cat 1/reports/report.txt

MD5 askldfansd23423mnavl;noja

sdlkfasdf
as;ldkjfasd
;laskdflasdf
alsdfj;alsdf
asdlkas;lgasdg

Network Activity

DNS:

HTTP:

Other Activity


Now I need the output like shown below.
*Output*
MD5 askldfansd23423mnavl;noja
Network Activity
DNS:
HTTP:

I can get the first line by the command
$*grep "MD5 " */reports/report.txt*
If I want the next Network Activity
$*grep "Network Activity" -A5 */reports/report.txt*

However how can I get to do both of these in the same line so that their
outputs are interleaved ?

-- 
Regards,
Balasubramaniam Natarajan
www.etutorshop.com/moodle/


More information about the ilugc mailing list