AlbertAguirre
Programmer
I need to duplilcate the last line in a file but change certain elements.
For instance:
tail -1 filename.txt
produces:
123 abc 456 def 123
I need to change all instances of "123" to "99".
I tried this:
tail -1 filename.txt | tr "123" "99"
But the result is:
993 abc 456 def 993
This is because "tr" does a character to character conversion. I need it to change the entire "123" string.
I cannot find the answer in man tr.
Help?
For instance:
tail -1 filename.txt
produces:
123 abc 456 def 123
I need to change all instances of "123" to "99".
I tried this:
tail -1 filename.txt | tr "123" "99"
But the result is:
993 abc 456 def 993
This is because "tr" does a character to character conversion. I need it to change the entire "123" string.
I cannot find the answer in man tr.
Help?