Bash String to Lower or Upper Case: Difference between revisions

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


=tr=
=tr=
<syntaxhighlight lang='bash'>
* [[Tr#To_Uppercase|tr to uppercase]]
echo "${text}" | tr '[:upper:]' '[:lower:]'
 
</syntaxhighlight>
=awk=
=awk=
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>

Revision as of 01:34, 11 December 2019

Internal

tr

awk

echo "${text}" | awk '{print tolower($0)}'

bash 4

sed

echo "${text}" | sed -e 's/\(.*\)/\L\1/'