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

  • From: bala150985@xxxxxxxxx (Balasubramaniam Natarajan)
  • Date: Thu, 26 Jul 2012 18:24:23 +0530

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/

Other related posts: