Awk and cases
- July 20th, 2017
- Posted in Documentation
- Write comment
Good stuff here. I always like to pick up these little things along the way.
If you want to change the case of a string using awk:
Lower case:
$ echo myuppercasestring | awk ‘{print tolower($1)}’
Upper case:
$ echo mylowercasestring | awk ‘{print toupper($1)}’
I used something like this to create little of commands to rename a bunch of upper case file names to lower case file names:
$ ls -c1 | awk ‘{print “mv ” $1 ” ” tolower($1)}’
No comments yet.