In Mac OS X Terminal, I can't seem to use the 'tr' command on a file.
For example, I have a text file called 'z.txt' on my desktop. I would like to substitute every letter 'a' into the letter 'e'.
tr "a" "e" z.txt
returns the following message:
usage: tr [-Ccsu] string1 string2
tr [-Ccu] -d string1
tr [-Ccu] -s string1
tr [-Ccu] -ds string1 string2
Conversely, this works just fine:
sed "s_a_e_g" z.txt
What syntax or quoting should I use to make the 'tr' approach work?
You can direct the file into tr.
tr "a" "e" < z.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With