0

I found solution but it doesn't working http://www.cyberciti.biz/faq/linux-unix-shell-programming-converting-lowercase-uppercase/

[root@mg0016 tmp]# y="this Is A test"
[root@mg0016 tmp]# echo "${y^^}"
-bash: ${y^^}: bad substitution
1
  • y="this Is A test"; y=${echo $y|tr "a-z" "A-Z"};echo y: $y`
    – paulsm4
    Commented Oct 11, 2012 at 17:50

2 Answers 2

2

You can use any one of the following code :

$ tr '[:lower:]' '[:upper:]' < input.txt > output.txt

or

$  sed -e 's/\(.*\)/\U\1/' input.txt > output.txt
2
  • 1
    The sed form isn't very portable (AFAIK it's GNU sed specific). The portable sed version would be sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' input.txt > output.txt. Commented Oct 11, 2012 at 17:51
  • @user1598202 - +1: great reply!
    – paulsm4
    Commented Oct 11, 2012 at 17:54
0

I found following one! and it works!

[spatel@mg0016 ~]$ echo "lower" | awk '{print toupper($0)}'
LOWER

Thanks for reply all.

Not the answer you're looking for? Browse other questions tagged or ask your own question.