![]() |
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 |
| Perl - converting selected characters to upper/lower case | doubleminus | UNIX for Dummies Questions & Answers | 2 | 05-19-2008 01:13 AM |
| Accepting Upper and Lower case | lweegp | Shell Programming and Scripting | 8 | 12-08-2007 06:57 PM |
| UNIX command to reverese lower and upper case | rfourn | Shell Programming and Scripting | 6 | 12-07-2007 10:33 PM |
| lower case to upper case string conversion in shell script | dchalavadi | UNIX for Dummies Questions & Answers | 3 | 05-29-2002 12:07 AM |
| Upper And Lower Case | pciatto | Shell Programming and Scripting | 1 | 04-29-2002 12:17 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Change Case UPPER-lower & lower - UPPER
Hi All,
I have a wrongly typed file i.e. Upper case letters are typed as lower and vice cerse i.e. "tHIS IS AN unix FORUM." I would like to do a conversion such that out out should be This is an UNIX forum' I would like to do in shell script . Any pointers? I know that we can use tr -s or typeset but using those I am able to convert either in either all lower or all upper. Can we do this using awk by taking each character in a array and converting. Any help will be hightly appreciated. cheers, |
|
||||
|
Quote:
It will work even without -s |
|
||||
|
While this will work perfectly on most systems, it is not portable to all systems.
Code:
/home/franklin >uname -a
HP-UX csu02 B.11.00 A 9000/800 126484691 two-user license
/home/franklin >tr -s '[a-z][A-Z]' '[A-Z][a-z]' etik
tr: The combination of options and String parameters is not legal.
Usage: tr [ -c | -cds | -cs | -ds | -s ] [-A] String1 String2
tr [ -cd | -cs | -d | -s ] [-A] String1
Code:
/home/franklin >tr '[a-z][A-Z]' '[A-Z][a-z]' etik
tr: The combination of options and String parameters is not legal.
Usage: tr [ -c | -cds | -cs | -ds | -s ] [-A] String1 String2
tr [ -cd | -cs | -d | -s ] [-A] String1
|
|
||||
|
This works fine for me, mine is AIX
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|