Re: Stupid spaces

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

 



well since we're all sharing space-removal tactics, here's my version: a
script i made to remove space (and other chars i dont like) from all files
in the current dir:
ls -1A > /tmp/desp.tmp
while read line
do
new=`echo -n "$line" | tr [:space:] _ | tr -d [=\(=][=\)=][=]=][=[=][=!=][=\'=][=,=][=?=] | tr [:upper:] [:lower:]`
if [ "$new" = "$line" ] ; then
continue
fi
mv -i -- "$line" "$new"
done < /tmp/desp.tmp
rm /tmp/desp.tmp




At 09:26 AM 02/13/2004, rich+ml@xxxxxxxxxxx wrote:
Works for me, however I did forget to quote $x in original example.

That would do it. for x in *; do mv "$x" ${x// /}; done removes the spaces, but only works in bash 2. :(


- : send the line "unsubscribe linux-admin" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html

- : send the line "unsubscribe linux-admin" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux