I tried using tr
to replace a variable name in a file, and I noticed some behavior I can't figure out if the variable has a repeated character.
For example:
echo "aab" | tr 'aab' 'xyz'
gives the result 'yyz' when I was expecting xyz.
Can anyone explain what is happening here?
I'm aware that I can use other commands like sed
to achieve the result I want, but I'm curious to understand what tr
is doing is this situation. I've looked at the man page and haven't found any other explanation of why this would happen. Thanks
man
pages for base tools contain any examples whatsoever, the downvote is nothing short of trolling. Why is this resource so obsessed with downvoting? – ajeh May 25 '18 at 16:01sed 's/aab/xyz/g' file
– glenn jackman May 25 '18 at 16:42