this is what i came up with:
$ cat replace_spaces_with_underscores.sh
#!/bin/ksh
while read filenames
do
mv "$filenames" "`echo "$filenames"sed -e 's/ /_/g'`"
# use below line if you don't want to replace it with underscore
#mv "$filenames" "`echo "$filenames"sed -e 's/ //g'`"
done < filenames_with_spaces
#!/bin/ksh
while read filenames
do
mv "$filenames" "`echo "$filenames"sed -e 's/ /_/g'`"
# use below line if you don't want to replace it with underscore
#mv "$filenames" "`echo "$filenames"sed -e 's/ //g'`"
done < filenames_with_spaces
but 1st u need to run this, dump filenames with spaces to one file:
$ ls grep " " > filenames_with_spaces
p/s: since i'm in nederland, maybe i should try their space cake :)
No comments:
Post a Comment