From: Meino Christian Cramer <Meino.Cramer@gmx.de>
To: zsh-users@sunsite.dk
Subject: Re: renameing numbered files
Date: Sun, 25 Jun 2006 07:12:47 +0200 (CEST) [thread overview]
Message-ID: <20060625.071247.41640232.Meino.Cramer@gmx.de> (raw)
In-Reply-To: <060624215422.ZM7997@torch.brasslantern.com>
From: Bart Schaefer <schaefer@brasslantern.com>
Subject: Re: renameing numbered files
Date: Sat, 24 Jun 2006 21:54:22 -0700
> On Jun 25, 5:25am, Meino Christian Cramer wrote:
> }
> } How can I do this in a most zshy way?
>
> autoload -U zmv
> zmv -Qf 'Example(<->).txt(On)' 'Example${(l:4::0:)$(($1+10))}.txt'
>
> That probably deserves some explanation:
Yes, of course! Magic always deserves some explanations !
:o) :o) :o):o):o) :o) :o) :o) :o):o) :o) :o) :o) :o) :o)
> Either the -Q option or (#qOn) is required because zmv turns off "bare"
> glob qualifiers by default.
>
> The -f option is required because the set of source names overlaps with
> the set of destination names (0102 is in both).
>
> Sorting (On) forces the higher-numbered files to be renamed first,
> otherwise 0092 --> 0102 --> 0112 will result (the original 0102 would
> be lost). If the leading zeroes weren't there, you'd need (nOn) for
> numeric sorting.
>
> Using $(($1+10)) discards leading zeroes, so (l:4::0:) puts them back.
>
> I suggest playing around with "zmv -n" a bit to be sure it's going to
> do what you intended.
>
Thanks a lot Bart!
I will experiment with that...
Have a nice weekend!
mcc
prev parent reply other threads:[~2006-06-25 5:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-25 3:25 Meino Christian Cramer
2006-06-25 4:54 ` Bart Schaefer
2006-06-25 5:12 ` Meino Christian Cramer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060625.071247.41640232.Meino.Cramer@gmx.de \
--to=meino.cramer@gmx.de \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).