![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Accepting Upper and Lower case | lweegp | Shell Programming and Scripting | 8 | 12-08-2007 02:57 PM |
| UNIX command to reverese lower and upper case | rfourn | Shell Programming and Scripting | 6 | 12-07-2007 06:33 PM |
| Converting file names to upper case | Sabari Nath S | Shell Programming and Scripting | 5 | 01-12-2006 09:38 AM |
| lower case to upper case string conversion in shell script | dchalavadi | UNIX for Dummies Questions & Answers | 3 | 05-28-2002 09:07 PM |
| Upper And Lower Case | pciatto | Shell Programming and Scripting | 1 | 04-29-2002 09:17 AM |
|
|
Submit Tools | LinkBack | Thread Tools | 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! |
| Forum Sponsor | ||
|
|
|
|||
|
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. |