Renaming files with a lot of spaces
I just want to rename a bunch of files on a Linux-Streaming-Server.
So my first approache was to substitute foo with bar
for file in *; do mv $file
echo $file | sed -r "s/foo/bar/"; done
But since the bash separator is a space this will not work with files which contains spaces.
So I have to remove or substitute the spaces before. I used translate (tr) to change the spaces to underlines:
for file in *; do mv “$file”
echo $file | tr ' ' '_'; done
An other approache is to change the bash seperator.