I am trying to make tr -d
remove a string of characters from an existing string, without it removing characters everywhere else.
For example, I want tr
to remove : OK
from the end of every string in foo.txt
.
Contents of foo.txt
:
BROKEN BONES: OK
Kefen Odvora: OK
BOOKS_FOR_MUM: OK
E: OK Amded: OK
This is the command I run:
cat foo.txt | tr -d ": OK$"
I want it to output this:
BROKEN BONES
Kefen Odvora
BOOKS_FOR_MUM
E: OK Amded
But instead I get this, which I don't want:
BRENBNES
efendvora
BS_FR_MUM
EAmded
How can I fix this?
cat
assed
could read Input_file itself. – Connective