LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   sed or awk question - replace caps with small letters (http://www.linuxquestions.org/questions/linux-general-1/sed-or-awk-question-replace-caps-with-small-letters-128216/)

computera 12-22-2003 07:12 PM

sed or awk question - replace caps with small letters
 
want to run a command on a directory, to change all file names in capital letters to small caps..

any suggestions?

much thanks

arooze 12-30-2003 04:39 AM

You could do it with a simple script like:

files=`ls|grep [A-Z]`
for i in $files
do
mv $i `echo $i | tr [A-Z] [a-z]`
done

# Mind the backquotes!!!!

If you put an 'echo' command before the 'mv' command you will see what will actually happen:
echo mv $i `echo $i | tr [A-Z] [a-z]`


All times are GMT -5. The time now is 01:11 AM.