CentOS Stream 9
Sponsored Link

Command Help

Command :   Back to index

tr : translate or delete characters
[SYNOPSIS] tr OPTION ARRAY1 [ARRAY2]
OPTION
-d delete characters in ARRAY1, do not translate
-s replace each sequence of a repeated character that is listed in the last specified ARRAY, with a single occurrence of that character
-t first truncate ARRAY1 to length of ARRAY2
 Usage example :
 [root@localhost ~]# cat test.txt
 AAAAA aaaaa
 BBBBB bbbbb
 CCCCC ccccc
 11111 22222
 33333 44444
 [root@localhost ~]# tr [:lower:] [:upper:] < test.txt
 AAAAA AAAAA
 BBBBB BBBBB
 CCCCC CCCCC
 11111 22222
 33333 44444
 [root@localhost ~]# tr [:blank:] '+' < test.txt
 AAAAA+aaaaa
 BBBBB+bbbbb
 CCCCC+ccccc
 11111+22222
 33333+44444
 [root@localhost ~]# tr '1' '5' < test.txt
 AAAAA aaaaa
 BBBBB bbbbb
 CCCCC ccccc
 55555 22222
 33333 44444
 

Matched Content