Hi,
I have a sample text file:
Code:
<category name="Temp1">something1</category><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
</TD></TR></TABLE></BODY></HTML>
<category name="Temp2">something2
</category>
New lines in the file may or may not occur.
I would like to get only those parts of the file which are between the closest 'category' tags, so in this example:
Code:
<category name="Temp1">something1</category><category name="Temp2">something2</category>
I am trying to force awk to do that like that:
Code:
awk -F "</?category.*>" '{ print $1 }' file.txt
But this command gives me only:
Code:
</TD></TR></TABLE></BODY></HTML>
Could anyone point me how to write the command properly?
Regards,
Robert