I have a file like the following
<g> Good wheatear </g> other parts of line
<g> The farm land is to be sold </g> other parts of line
<g> knock knock </g> other parts of line
I want my output to be like this:
<g> Good wheatear </g>
<g> The farm land is to be sold </g>
<g> knock knock </g>
i.e. print the content between <g> and </g> tags including the tags
I have tried this command:
awk '/<s>/, /<\/s>/' trsTest.txt
But it prints the whole line.
How to print the content between the tags ?
<g>
rather than<s>
other parts of line
can also include<g>
and or</g>
then you should include that in your sample input/output as those cases would break most possible solutions.