![]() |
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 |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 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 |
| Converting file names to upper case | Sabari Nath S | Shell Programming and Scripting | 5 | 01-12-2006 01:38 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 |
|
|
|
||||
|
Perl - converting selected characters to upper/lower case
Using STDIN, how can I use perl to take an input string, with all lower case letters in the first five characters, and convert them to uppercase...
then take all uppercase letters in the second five characters and convert them to lowercase. Example: MichaelSmith to michaELSMIth Thank you! |
|
||||
|
doubleminus,
try this... #!/usr/bin/perl $str = <STDIN>; chomp $str; print lc(substr($str, 0,5)) . uc(substr($str, 5, 5)) . substr($str, 10) . "\n"; Enter in MichaelSmith It lowercases the first 5 chars, concatenated to the uppercase of the next 5 characters, concatenated to the remaining characters, concatenated to a newline char. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|