I have many files which have filenames of the format
Code:
nameofwebsite.com : somename.html
I would like to replace the : by a dash i.e - as shown below
Code:
nameofwebsite.com - somename.html
I searched LQ and found a script that does the job recursively, but it's for replacing spaces by underscores. Since I don't know sed at all, can someone help me modify this script for replacing ':' by '-' ?
Code:
#!/bin/bash
# Recursive replacement of spaces with "_" in files/dirs
[ $# -ne "1" ] && echo "Usage: $0 <dir-path>" && exit 1
find $1 -name "* *" | sed 's/^.*$/mv \"&\"/g' > t1$$
find $1 -name "* *"|sed -e 's/ /_/g' -e 's/^.*$/\"&\"/g' >t2$$
paste t1$$ t2$$ > t3$$; sh t3$$; #rm -f t?$$
#[t?$$ files will help you in an accidental action]
Any other way to do this will be appreciated too. I initially tried
Code:
rename : - nameofwebsite.com*
This works, but not recursively.
Thanks in advance.