|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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 !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Printing all 'case' variations of a word
Hey Guys & Gals, I am trying to figure out how one would go about printing all possible variations of letter cases in a given word. So if for instance given the input "test123" output would be ; Code:
test123 Test123 TEst123 TESt123 TEST123 tEst123 tESt123 tEST123 teSt123 teST123 tesT123 etc. etc. until all case variations of 'test' have been printed. Any pointers on the correct way to move forward greatly appreciated ! |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Perhaps this pseudocode might be a good approach: Code:
convert string to lowercase
while there is a lowercase character in string
do
for every character in the string
do
if current character is in [[:alpha:]]
if current character is upper then
convert to lower
else
convert to upper
break
fi
fi
done
done |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| script to include filename with variations at the beginning of the file | iamzesh | Shell Programming and Scripting | 1 | 03-25-2011 11:01 AM |
| Convert to upper case first letter of each word in column 2 | cgkmal | Shell Programming and Scripting | 16 | 05-03-2010 11:27 AM |
| Convert first character of each word to upper case | harchew | Shell Programming and Scripting | 3 | 10-23-2009 03:05 PM |
| printing only the middle word between two patterns | tigta09 | UNIX for Dummies Questions & Answers | 7 | 09-09-2009 06:16 PM |
| Printing 1st column to lower case using awk | pinnacle | Shell Programming and Scripting | 11 | 05-18-2009 12:18 PM |
|
|