Bash String to Lower or Upper Case: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=Internal= * bash =tr= <syntaxhighlight lang='bash'> echo "${text}" | tr '[:upper:]' '[:lower:]' </syntaxhighlight> =awk= <syntaxhighlight lang='...") |
(→bash 4) |
||
Line 11: | Line 11: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=bash 4= | =bash 4= | ||
* [[Bash_Parameter_and_Variable_Expansion#To_Uppercase|bash 4 tp uppercase]] | |||
* [[Bash_Parameter_and_Variable_Expansion#To_Lowercase|bash 4 tp lowercase]] | |||
=sed= | =sed= | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
echo "${text}" | sed -e 's/\(.*\)/\L\1/' | echo "${text}" | sed -e 's/\(.*\)/\L\1/' | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 01:32, 11 December 2019
Internal
tr
echo "${text}" | tr '[:upper:]' '[:lower:]'
awk
echo "${text}" | awk '{print tolower($0)}'
bash 4
sed
echo "${text}" | sed -e 's/\(.*\)/\L\1/'