Bash String to Lower or Upper Case

From NovaOrdis Knowledge Base
Revision as of 01:30, 11 December 2019 by Ovidiu (talk | contribs) (Created page with "=Internal= * bash =tr= <syntaxhighlight lang='bash'> echo "${text}" | tr '[:upper:]' '[:lower:]' </syntaxhighlight> =awk= <syntaxhighlight lang='...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Internal

tr

echo "${text}" | tr '[:upper:]' '[:lower:]'

awk

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

bash 4

${text,,}

sed

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