CentOS Stream 9
Sponsored Link

Commands Help

Command :   Back to index

tr : translate or delete characters
[SYNOPSIS] tr OPTION SET1 [SET2]
OPTION
-d delete characters in SET1, do not translate
-s replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that character
-t first truncate SET1 to length of SET2
 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