zsh-workers
 help / color / mirror / code / Atom feed
* Getting rid of temporaries...
@ 2003-09-10 20:34 DervishD
  2003-09-10 22:38 ` Danek Duvall
  0 siblings, 1 reply; 15+ messages in thread
From: DervishD @ 2003-09-10 20:34 UTC (permalink / raw)
  To: Zsh

    Hi all :))

    I want to do something with a list of files, and currently I need
a temporary variable (an array). I can do the same using find, I
suppose, but I want to do it in Zsh.

    I have a directory structure containing files whose names match
the expression '*.??.jpg'. There are some images numbered with a two
digit number. There are only one-directory depth. So, with this:

    print -l /directory/*/*

    I can print all filenames. No problem with this. The problem is
that I want to strip the number and the '.jpg' suffix from the names.
If I have the filename in a parameter, I can do:

    print -l ${parameter%.??.jpg}

    and that will do. The problem is that I want to do it in all
filenames, so I must say something like:

    typeset -a array=(/directory/*/*)
    print -l ${array%.??.jpg} | uniq

    The 'uniq' is because without the number and the extension, there
are lots of duplicates (that is what the number is for ;)), and I
want to get rid of them.

    Now the question: how can I do this without using the temporary
parameter 'array' and, if possible, without 'uniq'. I think that some
arrays can be configured to store unique copies of elements, and in
fact the (t) flag (expansion flag?) can say 'unique' for those
arrays, but I don't have damned idea of how can I declare such
arrays.

    My excuses if I'm doing lots of questions (even trivial of weird
ones), but I'm on the way of seriously learning Zsh, and I'm starting
with the user friendly guide ;)) Thanks a lot for your collaboration
and help, truly :)

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2003-09-13 17:10 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-10 20:34 Getting rid of temporaries DervishD
2003-09-10 22:38 ` Danek Duvall
2003-09-11  1:06   ` Bart Schaefer
2003-09-11  1:46     ` Danek Duvall
2003-09-11  6:29     ` Oliver Kiddle
2003-09-11  8:56       ` Bart Schaefer
2003-09-11  9:40         ` DervishD
2003-09-11  9:43         ` DervishD
2003-09-11  9:39       ` DervishD
2003-09-12  9:27         ` Oliver Kiddle
2003-09-12 18:39           ` Bart Schaefer
2003-09-13 17:13             ` DervishD
2003-09-13 17:12           ` DervishD
2003-09-11  9:36     ` DervishD
2003-09-11  9:30   ` DervishD

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).