Tag: tr

  • Linux tr command (translate)

    Linux tr command (translate)

    The tr command is used to translate text.

    Example

    root@ok:~# echo "serverok" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
    SERVEROK
    root@ok:~# 
    

    You can also use

    root@ok:~# echo "serverok" | tr "a-z" "A-Z"
    SERVEROK
    root@ok:~# 
    

    To change specific chars

    root@ok:~# echo "serverok" | tr "sok" "SOK"
    ServerOK
    root@ok:~# 
    

    To delete char, use -d option

    root@ok:~# echo "serverok" | tr -d "ok"
    server
    root@ok:~# 
    

    See Linux Commands