Re: Fixing filenames with directories with spaces in the names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



From: Craig White <craigwhite@xxxxxxxxxxx>

> 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.
> Anyway, $FILENAME  has...
> /tmp/New Woman In Field/*NEW woman in field.psd
> /tmp/New Woman  In Field/*NEW woman in field 2.eps
> /tmp/New Woman In Field/*NEW woman in  field 2.psd
> and the echoes are broken with spaces like this (which of  course  doesn't
> work)...

Not sure what you are trying to do (delete or rename or...), but try "while 
read" instead of for (especially since the cmdline is limited)...
Example:

cat "$FILENAME" | while read OLD
  do
    NEW=$(echo "$OLD" | sed 's/\*/\-/')
    mv -i "$OLD" "$NEW"
  done

JD


      
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux