Tr

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Internal

Overview

Translate characters.

Options

-d

Delete from the input the characters specified in the given string.

Example, delete new lines:

cat ./test.txt | tr -d \\n

To Uppercase

Also see bash Parameter and Variable Expansion.

First Character

$(echo ${var_name:0:1} | tr '[:lower:]' '[:upper:]')${var_name:1}

All Characters

echo "hi" | tr '[:lower:]' '[:upper:]'