I have some confusions regarding the way -s, -t, -c option work in tr command.
when I do this:
echo i am a good boy | tr good bad
output: i am a bddd bdy
This is quite understandable, because since o is repeated in good, the last possible change in place of o is d, and hence the output
now when I do this:
echo i am a good boy | tr -s good bad
output: i am a bd bdy
the -s option is supposed to squeeze every repeated occurence of each character in set 1 into a single occurence and then change each character in set 1 into the corresponding character in set 2 which is in the same position. so it should have been
i am a bad bay.
can anyone explain the change?
moreover when I do
echo i am a good boy | tr -c good bad
I get dddddddgoodddodd
can anyone explain in details how a -c option works for tr, referring to this example.
And finally:: how to change myself from good boy to a bad boy.... :) :P i.e.
echo i am a good boy | tr <something> ...gives me the output as::i am a bad boy
"note::this is solely for the purpose of learning unix,not to change myself from good to bad in reality ... ;) "