made this squeeze multiple spaces into single underscore.
authorChris Koeritz <fred@gruntose.com>
Sat, 6 Apr 2013 20:55:07 +0000 (16:55 -0400)
committerChris Koeritz <fred@gruntose.com>
Sat, 6 Apr 2013 20:55:07 +0000 (16:55 -0400)
scripts/files/spaces_to_underscores.sh

index eb56f7bb6db7839fb4d1b3f9165c0825d6e1784c..07b8a1c0c5f75841b931d61930c802b45cc099af 100644 (file)
@@ -12,7 +12,7 @@ fi
 
 while [ $# -gt 0 ]; do
   file="$1"; shift
-  newname="$(echo "$file" | tr ' ' '_' | tr -d "\~'" | sed -e 's/\([0-9]\)_\./\1./g' )"
+  newname="$(echo "$file" | tr -s ' ' '_' | tr -d "\~'" | sed -e 's/\([0-9]\)_\./\1./g' )"
   if [ "$file" != "$newname" ]; then
     # we've effected a name change, so let's actually do it.
     echo "moving '$file' => '$newname'  "