Bash String to Lower or Upper Case: Difference between revisions

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


=awk=
=awk=
<font color=darkgrayNOT TESTED</FONT>
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
echo "${text}" | awk '{print tolower($0)}'
echo "${text}" | awk '{print tolower($0)}'
</syntaxhighlight>
</syntaxhighlight>
=bash 4=
=bash 4=
* [[Bash_Parameter_and_Variable_Expansion#To_Uppercase|bash 4 tp uppercase]]
* [[Bash_Parameter_and_Variable_Expansion#To_Uppercase|bash 4 tp uppercase]]

Revision as of 01:35, 11 December 2019

Internal

tr

awk

<font color=darkgrayNOT TESTED

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

bash 4

sed

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