Just had a requirement to print the current line with pattern and next line.
This seems to be pretty straight forward with AWK
if you put c=2, it will print the next two lines
Eg. sampleData.txt containg..
EmployeeName
ABC
XYZ
QPR
LMN
will print..
EmployeeName
ABC
if you don't want headers..
This seems to be pretty straight forward with AWK
awk '/YOUR_STRING/{c=1;{print}next}c-->0' <yourFile>
if you put c=2, it will print the next two lines
Eg. sampleData.txt containg..
EmployeeName
ABC
XYZ
QPR
LMN
awk '/EmployeeName/{c=1;{print}next}c-->0' sampleData.txt
will print..
EmployeeName
ABC
if you don't want headers..
awk '/EmployeeName/{c=1;next}c-->0' sampleData.txt