trtr (abbreviated from translate or transliterate) is a command in Unix-like operating systems.
echo "ABcd" | tr '[A-Z]' '[a-z]'
echo "abcd" | tr 'abcd' 'jkmn'
echo "123abcABC¤¤¤ċ" | tr -cd '[:alnum:]'
Therefore, removes all non-alphanumeric characters.
tr -s '\n' '\n'The -s flag causes tr to compress sequences of identical adjacent characters in its output to a single token
Therefore, replaces sequences of one or more newline characters with a single newline.
cat /etc/passwd | tr -d '\t\n\r\f'To delete the all whitespace , tab , breakline character in the output content
cc, ddd, ee
cat /etc/passwd | tr -d ':'To delete the : character in the output content.
cat /etc/passwd | tr '\t' ','replace tag field to comma to the content
eg: aaa bbb ---> aaa,bbb
tr -d '\r'The -d flag causes tr to delete all tokens of the specified set of characters from its input. In this case, only a single character set argument is used. The following command removes carriage return characters, thereby converting a file in DOS/Windows format to one in Unix format
Server is hosted by Alanstudio
Linux Operating System
Recommend screen resolution 1024 x 768 / IE / FireFox
Alan Studio © 2007 by Alan Cheung Hin Lun. All rights reserved.