selkum
1
Hi,
I need to find all strings in single quote and change the case of the string to UPPER.
Example:
Input:
xyz abc ccc 'zxxx7U'
dfsdf sdfdd aaa 'oR77' and 'or88'
Output:
xyz abc ccc 'ZXXX7U'
dfsdf sdfdd aaa 'OR77' and 'OR88'
Appreciate your help!!
Thanks
Selva
daptal
2
sed "s/'\(.*\)'/'\U\1'/" file_name
HTH,
PL
I think a lazy match should be used (this works in GNU sed on matches on the same line)
sed "s/'\([^']*\)'/'\U\1'/g"
awk '{for (i=1;i<=NF;i++) {if ($i~/^'\''.*'\''$/) $i=toupper($i)}}1' urfile
interesting, one single quota need be used as '\'' in awk (three single quotas)
selkum
5
The \U does not work, other parts work.
\U works only in VI editor, but not while part of a script.
The solution of rdcwayx should work.
Another one:
awk -F"'" '{for(i=2;i<NF;i+=2){$i=toupper($i)}}1' OFS="'" file
selkum
7
It works now. thanks a lot.....