Today I learnt a bit about tr
command.
But I was stuck at understanding the difference between -c
and -C
.
On the manual, it said:
-C Complement the set of characters in string1, that is ``-C ab'' includes every character except for `a' and `b'.
-c Same as -C but complement the set of values in string1.
I'm not quite understand what does set of values in string1
of -c
option mean.
I thought it may treat string 1 "ab"
as a whole and will escape single a
and b
.
So I did an experiment:
⇒ echo "ab_a_b" | tr -C 'ba' 'c'
abcacbc%
⇒ echo "ab_a_b" | tr -c 'ba' 'c'
abcacbc%
Things didn't match my expectation!
So, what's the difference between -C
and -c
in tr
command?
Software Version: BSD 2004 on OSX10.10