Tr: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 6: Line 6:


Translate characters.
Translate characters.
=Options=
==<tt>-d</tt>==
Delete from the input the characters specified in the input string.
Example, delete new lines:
<syntaxhighlight lang='bash'>
cat ./test.txt | tr -d \\n
</syntaxhighlight>


=To Uppercase=
=To Uppercase=

Revision as of 02:11, 10 May 2022

Internal

Overview

Translate characters.

Options

-d

Delete from the input the characters specified in the input 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:]'