Home > bash, sed > sed – Convert to upper case

sed – Convert to upper case

Problem:
I need to covert text to UPPER CASE using sed.

Solution:

user@computer:~$ echo "first,second,third" |\
sed 's/\([a-z]\+\),/\U\1,/'
FIRST,second,third

Source:
http://nixcraft.com/shell-scripting/15862-sed-convert-text-lower-upper-case.html

Advertisements
Categories: bash, sed
  1. December 29, 2012 at 12:24 pm

    another way to do it, with “tr”: echo abc | tr ‘[:lower:]’ ‘[:upper:]’

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: