Hi,
I want to print the lines in a file that matches particular string format using shell scripting.
you can use grep ,sed or awk
just go through the man pages
Thanks for ur reply..Once string format is matched i want to print same line and next four lines in a seperate file and again i need to search for string format in a file.
Whenever string format is matched i need to print same line and next four lines in a seperate output file.
Please provid the sample script using shell scripting or PERL.
try this
awk '/pattern/{print};c-->0;/pattern/{c=4}' filename > outfile
Another form of vidyadhar85 solution :
awk '/pattern/{print;c=4;next};--c>0' filename > outfile
Jean-Pierre.