Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: pad numbers
- X-seq: zsh-users 13456
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: fREW Schmidt <frioux@xxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: pad numbers
- Date: Sat, 15 Nov 2008 19:39:23 +0000
- In-reply-to: <20081115190424.GA92205@xxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: fREW Schmidt <frioux@xxxxxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <fb3648c60811151008m68a8125jbe0db623500516ee@xxxxxxxxxxxxxx> <20081115183337.GF3238@xxxxxxxxx> <fb3648c60811151036l32c43737k66b5faf57a142e9b@xxxxxxxxxxxxxx> <20081115190424.GA92205@xxxxxxxxxxxxxxxxxxxx>
On Sat, Nov 15, 2008 at 11:04:25AM -0800, Phil Pennock wrote:
[...]
> Recreating the original files, then:
> % zmv '([[:digit:]]|[[:digit:]][[:digit:]])([^[:digit:]]*)' '${(l:3::0:)1}$2'
> % ls
> 001 - Foo 002 - Bar 003 - Baz 100 - Fred 2000 - Long
Or:
zmv -n '(<0-999>)(*)' '${(l:3::0:)1}$2'
Which BTW changes "00002 - X" to "002 - X".
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author