Bash String to Lower or Upper Case: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:


=awk=
=awk=
<font color=darkgrayNOT TESTED</FONT>
<font color=darkgray>NOT TESTED</FONT>
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
echo "${text}" | awk '{print tolower($0)}'
echo "${text}" | awk '{print tolower($0)}'
Line 16: Line 16:


=sed=
=sed=
<font color=darkgray>NOT TESTED</FONT>
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
echo "${text}" | sed -e 's/\(.*\)/\L\1/'
echo "${text}" | sed -e 's/\(.*\)/\L\1/'
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 01:35, 11 December 2019

Internal

tr

awk

NOT TESTED

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

bash 4

sed

NOT TESTED

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