Artificial intelligent assistant

Print a portion of a lines in a text file between predefined tags 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 ?

With `awk` it could be:


$ awk -v FS="" '{print $2}' trsTest.txt
Good wheatear
The farm land is to be sold
knock knock


Or if you want to keep the tags:


$ awk -v FS=" " '{print $1 FS}' trsTest.txt
Good wheatear
The farm land is to be sold
knock knock

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 07477af3deae5f0ffdd6a73e7b80505e