![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Lowercase to Uppercase | ggovotsis | AIX | 7 | 10-16-2008 11:07 AM |
| only uppercase first character? | fedora | Shell Programming and Scripting | 7 | 09-26-2008 09:12 PM |
| make uppercase | kirkm76 | UNIX for Dummies Questions & Answers | 4 | 05-29-2007 12:28 AM |
| Converting to Uppercase | dreams5617 | Shell Programming and Scripting | 3 | 11-12-2004 01:44 AM |
| uppercase to lowercase | webex | Shell Programming and Scripting | 4 | 01-03-2002 02:15 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Conversion to uppercase - tr
Hi,
I am trying to convert the $i in loop from lower to upper case but getting error like ' awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.' .. Requirement: I have many table in script XXX.sql which starting with 'ABC_','AbC_','aBc_' etc.. same thing for table starting with XYZ. I need all these table names. Could u plz help me on that. grep -iE "ABC_|XYZ_" /ukdw/prd/working/TDMatrix/srualcb02/ukdw/prd/bin/XXX.sql | awk '{printf("%s ",$0)}END{print "\n"}' | sed 's/,/ /g;s/ / /g' | awk 'BEGIN{FS=" "} { for(i=1;i<=NF;i++) { fieldToCheck= $i | tr '[a-z]' '[A-Z]' if (index($fieldToCheck,"ABC")>0){print $i}; if (index($fieldToCheck,"XYZ")>0){print $i}; } }' |
|
||||
|
Replace this:
Code:
fieldToCheck= $i | tr '[a-z]' '[A-Z]'
if (index($fieldToCheck,"ABC")>0){print $i};
if (index($fieldToCheck,"XYZ")>0){print $i};
Code:
fieldToCheck=toupper($i)
if (index(fieldToCheck,"ABC")>0){print $i}
if (index(fieldToCheck,"XYZ")>0){print $i}
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|