Lance Hoffmeyer <[EMAIL PROTECTED]> writes:

> I have a number of subdirectories where I have files with - such as 
> name - title.txt and I wish to convert them to:
> name: title.txt
> 
> In bash I tried:
> 
> for i in *-*;do mv $i `echo $i | sed -e 's/ - /:/'`'done 
                                                     ^
                                              This should be a ';'.

You have to quote the filenames, if they contain white spaces.

The following, for example, works:

for name in *-*; do
  new_name=$(echo $name | sed -e 's/\ -\ /: /;'); mv "$name" "$new_name"
done

        moritz
-- 
/* Moritz Schulte <[EMAIL PROTECTED]>
 * http://hp9001.fh-bielefeld.de/~moritz/
 * PGP-Key available, encrypted Mail is welcome.
 */

Reply via email to