How can I change the case of a matching group from lower to uppercase with sed Unix command?
Thanks Martin
How can I change the case of a matching group from lower to uppercase with sed Unix command?
Thanks Martin
I know this is a sed question just wanted to point out there are several ways to do that function. awk is a tool that was made for text wrangling and in some cases is easier to use. In my opinion this is one of these times:
#!/bin/sh
INFO="This is a test"
ALLCAPS=`echo $INFO | awk '{print toupper($0)}'`
echo $ALLCAPS
Yields: THIS IS A TEST
Surround your matching pattern in parentheses ie: \(pattern\) and then use \U\1 as the replacement text. \1 is the matching pattern and \U forces uppercase.
echo abcdef | sed -e 's/\(abc\)/\U\1/'