Craig White wrote:
Should be simple and perhaps I'm tired but it's not coming to me.
In its simplest form...
for old in `cat "$FILENAME"`;do echo "$old" dirname "$old" new="$(echo $old | sed 's/*/-/')" done
I'm trying to take out some stupid Macintosh things - in this case filenames with asterisks but I have others like tilde's and probably others that I haven't come across.
I found a nice little Perl script named "cmv" that will do all sorts of file name transformations along the lines you were discussing. You can get it at http://felix.canids.net/plaintext/cmv
Essentially you pass it a Perl regular expression string and a list of files to use the string upon. If you wanted to replace all occurrences whitespace with a single hyphen for the files in a directory:
cmv 's/\s+/-/g' *
This would find all instances of one or more white space characters and replace them with a single hyphen for every file in the current directory. I've used this for about a year now and it has worked great.
Hope that helps!