I have a file mixed with lower-case letters and upper-case letters, can I use awk
to convert all the letters in that file into upper-case?
If Perl is an option:
perl -ne 'print uc()' file
-n
loop around input file, do not automatically print line-e
execute the perl code in quotesuc()
= uppercaseTo print all lowercase:
perl -ne 'print lc()' file
Try this:
$ echo mix23xsS | awk '{ print toupper($0) }'
MIX23XSS
Something like
< yourMIXEDCASEfile.txt awk '{print toupper($0)}' > yourUPPERCASEfile.txt
You can use awk
, but tr
is the better tool:
tr a-z A-Z < input
or
tr [:lower:] [:upper:] < input
You mean like this thread explains: http://www.unix.com/shell-programming-scripting/24320-converting-file-names-upper-case.html (Ok, it's about filenames, but the same principle applies to files)
Try this:
awk '{ print toupper($0) }' <<< "your string"
Using a file:
awk '{ print toupper($0) }' yourfile.txt