Re: renaming multiple files

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

 



At 11/23/2004 01:30 AM +0000, Glynn Clements wrote:
        for file in prefix-* ; do
            mv "$file" "${file##prefix-}"
        done

Almost correct. What happens if one of the files is named "prefix-prefix-1"? What about "prefix-"?

I suggest:

for file in prefix-?*
do
mv "$file" "${file#prefix-}"
done

--
Jeff Woods
"Errors creep into everything, and the only way to expunge them is to have any bit of work reviewed by a few others." -- Wirt Atmar, 10-27-2001
"The great thing about Open Source software is that you can have any color screen of death that you want." -- Gavin Scott, 08-22-2000



- : 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