[Techtalk] lower to upper case
Miriam English
mim at miriam-english.org
Tue Oct 9 01:28:48 UTC 2007
Hi folks,
I've been playing around with the wonderful Celestia http://shatters.net
satisfying my space travel desires. Lately I've been adding on some of
the more detailed models and textures. This morning I downloaded the
latest International Space Station models and textures. After spending a
while wondering why the textures don't appear on the model I realised
it's because they were prepared on a Microsoft OS and the case of the
filenames are all wrong. They are in lowercase, but the model expects
uppercase.
After puzzling for a while over the easiest way to rename all the files
I ended up using a clunky method where I listed the files to a quick
script file, then opened it in my favorite text editor, copied and
pasted the column of filenames again in block select mode, and flipped
the case of the second column. Finally I added mv at the beginning of
each line and ran the file as a shell script.
It worked, and was a lot easier than renaming the 36 files by hand, but
it seemed to me that there must be a much simpler way using a loop and
expressions:
for file in *
do
mv $file `echo $file | tr '[a-z]' 'A-Z'`
done
In my text editor I'd simply replace each filename with \U& but that
isn't possible directly in bash.
Is there an even simpler way?
Cheers,
- Miriam
--
---------=---------=---------=---------=---------=---------=------
A life! Cool! Where can I download one of those from?
---------=---------=---------=---------=---------=---------=------
Website: http://miriam-english.org
Blog: http://www.livejournal.com/users/miriam_e/
More information about the Techtalk
mailing list