Let you have the following lines in a file 'test'
<element name="select">
<choice>
<value type="token">A</value>
<value type="token">B</value>
<value type="token">C</value>
</choice>
</element>
***Note- If you want to modify those patterns in the file containing the patterns itself use -i as argument with 'sed' command.
#sed 's/token/PATTERN/' test
will replace all 'token' in the file with 'PATTERN'
Just check it out....
#sed '/token/d' test
will delete all lines which contain the 'token'
Just check it out...
#sed 's/token//' test
will remove all 'token' from the file. It just remove those pattern not the lines containing pattern.
#sed '3 a\HAI ' test
will add 'HAI' in the 3rd line. We can give line number and the new line content as you wish...
Just replace 3 with new line number and 'HAI' with new line content....