[SYNTAX] tr command
[SYNTAX] tr command
Translate characters.
Syntax
Examples
Source : http://www.computerhope.com/unix/utr.htm
Syntax
- Code:
tr [-c] [-d] [-s] [string1] [string2]
-c | Complement the set of characters specified by string1. |
-d | Delete all occurrences of input characters that are specified by string1. |
-s | Replace instances of repeated characters with a single character. |
string1 | First string or character to be changed. |
string2 | Second string or character to change the string1. |
Examples
- Code:
$ cat 1.txt
hi u der
make hi files wonderful
things computer windows hi
hi make ubuntu files
recover delete hi things
computer
computerjee
$ tr -c '[a-k]\n' '@' < 1.txt
hi@@@de@
@ake@hi@fi@e@@@@@de@f@@
@hi@g@@c@@@@@e@@@i@d@@@@hi
hi@@ake@@b@@@@@fi@e@
@ec@@e@@de@e@e@hi@@hi@g@
c@@@@@e@
c@@@@@e@jee
$ tr -d ' ' < 1.txt
hiuder
makehifileswonderful
thingscomputerwindowshi
himakeubuntufiles
recoverdeletehithings
computer
computerjee
$ tr -t '[a-z]' '[A-Z]' < 1.txt
HI U DER
MAKE HI FILES WONDERFUL
THINGS COMPUTER WINDOWS HI
HI MAKE UBUNTU FILES
RECOVER DELETE HI THINGS
COMPUTER
COMPUTERJEE
Source : http://www.computerhope.com/unix/utr.htm
Similar topics
» [SYNTAX] sed command
» [SYNTAX] grep command
» dbt in syntax
» [ SYNTAX ] Control Structures in Shell
» [SYNTAX] Working with Directories and Files
» [SYNTAX] grep command
» dbt in syntax
» [ SYNTAX ] Control Structures in Shell
» [SYNTAX] Working with Directories and Files
Permissions in this forum:
You cannot reply to topics in this forum
|
|