Reputation: 1803
I have the following string:
"Last updated Unknown </DIV> </DIV></DIV></TD></TR></TABLE></FORM></DIV></BODY></HTML>"
and I am trying a simple example to replace HTML with test but if I try this example I get a unexpected results:
echo "Last updated Unknown</DIV></DIV></DIV></TD></TR></TABLE></FORM></DIV></BODY></HTML>" | tr "HTML" "test"
Result:
tast updated Unknown </DIV> </DIV></DIV></eD></ eR></eABtE></FORs></DIV></BODY></test>
Upvotes: 0
Views: 2511
Reputation: 924
tr
is used to translate or delete characters. Try sed
instead:
sed 's/HTML/test/g'
Upvotes: 3
Reputation: 23058
tr "HTML" "test"
replaces H
by t
, T
by e
, M
by s
and L
by t
.
You could use sed
instead.
$ echo "Last updated Unknown </DIV> </DIV></DIV></TD></TR></TABLE></FORM></DIV></BODY></HTML>" | sed 's/HTML/test/g'
Last updated Unknown </DIV> </DIV></DIV></TD></TR></TABLE></FORM></DIV></BODY></test>
Upvotes: 2