Hi all,
Is there a way to use the sed command to get the second range?
For instance:
sample.dat:
-------------
11111
22222
33333
44444
-------------
using "sed -n '/^ping/,/^$/p' sample.dat can get the first 2 lines.
But is there a way to get the first 4 lines, from beginning to the line with "3"?
Thanks in adv.
Thanks for the answer.
But it is not the exact one i need, since in my case, the line number for first part, above the first blank line, maybe variable.
It would be great if there is a way to get the line from "1111" to the line above the second blank line, the line 5 in my sample.
You don't need to match the blank lines
sed -n '/^11111$/,/^33333$/p' infile
If this is not what you want, post your real data and desired output.
nawk 'BEGIN{FS=RS="";ORS=ORS ORS}FNR<=2' myFile