tr is used for text conversion i.e convert from something to something else such as converting from "smaller case" to "upper case" and ";" into ":"
[user1@localhost Folder]$ cat Winner-List.txt Name, Sport, Medal Amar, Cricket, Bronze Akbar, Cricket, Silver Amar, Kabaddi, Silver Akbar, Kabaddi, Broze Anthony, Cricket, Gold Anthony, Kabaddi, Gold Hello; Hi; Bye [user1@localhost Folder]$ cat Winner-List.txt| tr ", " ";" Name;;Sport;;Medal Amar;;Cricket;;Bronze Akbar;;Cricket;;Silver Amar;;Kabaddi; Silver Akbar;;Kabaddi;;Broze Anthony;;Cricket;;Gold Anthony;;Kabaddi;;Gold Hello;;Hi;;Bye [user1@localhost Folder]$ cat Winner-List.txt| tr "a-z" "A-Z" NAME, SPORT, MEDAL AMAR, CRICKET, BRONZE AKBAR, CRICKET, SILVER AMAR, KABADDI, SILVER AKBAR, KABADDI, BROZE ANTHONY, CRICKET, GOLD ANTHONY, KABADDI, GOLD HELLO; HI; BYE [user1@localhost Folder]$
Switch | Description |
---|---|
s | Search |
g | Globally (without g - it convert only first occurance from each line). |
[user1@localhost Folder]$ cat Winner-List.txt Name, Sport, Medal Amar, Cricket, Bronze Akbar, Cricket, Silver Amar, Kabaddi, Silver Akbar, Kabaddi, Broze Anthony, Cricket, Gold Anthony, Kabaddi, Gold Hello; Hi; Bye [user1@localhost Folder]$ cat Winner-List.txt | sed 's/,/;/' Name; Sport, Medal Amar; Cricket, Bronze Akbar; Cricket, Silver Amar; Kabaddi, Silver Akbar; Kabaddi, Broze Anthony; Cricket, Gold Anthony; Kabaddi, Gold Hello; Hi; Bye [user1@localhost Folder]$ cat Winner-List.txt | sed 's/,/;/g' Name; Sport; Medal Amar; Cricket; Bronze Akbar; Cricket; Silver Amar; Kabaddi; Silver Akbar; Kabaddi; Broze Anthony; Cricket; Gold Anthony; Kabaddi; Gold Hello; Hi; Bye [user1@localhost Folder]$ cat Winner-List.txt | sed 's/,/;/g' | sed 's/ //g' Name;Sport;Medal Amar;Cricket;Bronze Akbar;Cricket;Silver Amar;Kabaddi; Silver Akbar;Kabaddi;Broze Anthony;Cricket;Gold Anthony;Kabaddi;Gold Hello;Hi;Bye [user1@localhost Folder]$ cat Winner-List.txt | sed 's/,/;/g' | sed 's/ //g' | sed 's/\t//g' Name;Sport;Medal Amar;Cricket;Bronze Akbar;Cricket;Silver Amar;Kabaddi;Silver Akbar;Kabaddi;Broze Anthony;Cricket;Gold Anthony;Kabaddi;Gold Hello;Hi;Bye [user1@localhost Folder]$