i have text between html tags. For example:
<td>vip</td>
I will have any text between tags <td></td>
How can i cut any text from these tags and put any text between these tags.
I need to do it via bash/shell.
How can i do this ?
First of all, i tried to get this text, but without success
sed -n "/<td>/,/<\/td>/p" test.txt
. But in a result i have
<td>vip</td>
. but according to documentation, i should get only vip
You can use this to get the value
vip
If you Input_file is same as shown example then following may help you too.
Simply printing the tag with echo then using awk to create a field separator >< then printing the 3rd field then which is your request.
You can try this:
Note that it will only work for the
<td>
tags. It will replace everything between tags<td>
(actually with them together and put the tags back) withTEXT_TO_REPLACE_BY
.