Re: renaming multiple files

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

 



Jeff Woods 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"?

It gets renamed to prefix-1, which is what I would expect.

> What about "prefix-"?
> 
> I suggest:
> 
> for file in prefix-?*
> do
> mv "$file" "${file#prefix-}"
> done

Huh?

-- 
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
-
: 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