Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Sed print range of lines between line number and pattern

$
0
0
Hi,

I have a file as below

This is the line one
This is the line two
<\XMLTAG>
This is the line three
This is the line four
<\XMLTAG>

Output of the SED command need to be as below.

This is the line one
This is the line two
<\XMLTAG>

Please do the need to needful to get the desired output. I tried with sed -n '1,/<\XMLTAG>/p' filename, it is printing the whole file

Thanks
RMN

Viewing all articles
Browse latest Browse all 16232

Trending Articles