updated to strip out the nutty pattern we get from turning ' - ' into '_-_', where we
authorChris Koeritz <fred@gruntose.com>
Sun, 12 May 2013 17:21:25 +0000 (13:21 -0400)
committerChris Koeritz <fred@gruntose.com>
Sun, 12 May 2013 17:21:25 +0000 (13:21 -0400)
really only want the dash left behind.

scripts/files/spaces_to_underscores.sh

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