zsh-users
 help / color / mirror / code / Atom feed
* Question about extended globbing
@ 2003-11-22 23:55 David Gómez
  2003-11-23  0:22 ` DervishD
  0 siblings, 1 reply; 5+ messages in thread
From: David Gómez @ 2003-11-22 23:55 UTC (permalink / raw)
  To: Zsh-users

Hi all ;),

I'm trying to create a pattern to match a given set of files that do not
match some pattern. I found that the ^ globbing operator, with the option
extended_glob set would help me to do this, but the thing is that i don't
know how to make two patterns to be affected by this operator,

I tried something like:

grep something $FOO/^{*txt,*info}

but it didn't work. How can I achieve to include several alternatives with
the ^ operator?

Thanks,

-- 
David Gómez

"The question of whether computers can think is just like the question of
whether submarines can swim." -- Edsger W. Dijkstra


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

* Re: Question about extended globbing
  2003-11-22 23:55 Question about extended globbing David Gómez
@ 2003-11-23  0:22 ` DervishD
  2003-11-23  9:09   ` David Gómez
  0 siblings, 1 reply; 5+ messages in thread
From: DervishD @ 2003-11-23  0:22 UTC (permalink / raw)
  To: David Gómez; +Cc: Zsh-users

    Hi David :)

 * Davilín <david@pleyades.net> dixit:
> grep something $FOO/^{*txt,*info}
> 
> but it didn't work. How can I achieve to include several alternatives with
> the ^ operator?

    Like this: grep something $FOO/^(*txt|*info)

    I may be wrong, of course, but I think that the braces you are
using are took literally in the pattern, or they are used just for
brace expansion, generating something like:

    grep something $FOO/^*txt $FOO/^*info

    That way, when filename generation takes place, it expands the
first expression, which include any *info file, and then it expands
the second expression, which contains any *txt file.

    I think we are in the second case, brace expansion and after that
filename generation. See if you have dupes in the generated file list
(use 'print' instead of grep. I've done and I have two lists, the
first doesn't include any *txt file, the second doesn't include any
*info file).

    Raúl Núñez de Arenas Coronado

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


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

* Re: Question about extended globbing
  2003-11-23  0:22 ` DervishD
@ 2003-11-23  9:09   ` David Gómez
  2003-11-23 10:10     ` DervishD
  0 siblings, 1 reply; 5+ messages in thread
From: David Gómez @ 2003-11-23  9:09 UTC (permalink / raw)
  To: Zsh-users

Hi Raúl ;),

>  * Davilín <david@pleyades.net> dixit:
> > grep something $FOO/^{*txt,*info}
> > 
> > but it didn't work. How can I achieve to include several alternatives with
> > the ^ operator?
> 
>     Like this: grep something $FOO/^(*txt|*info)

I knew that the answer had to be simple ;), i just was to sleepy yesterday
to think of this solution ;)).

>     grep something $FOO/^*txt $FOO/^*info
> 
>     That way, when filename generation takes place, it expands the
> first expression, which include any *info file, and then it expands
> the second expression, which contains any *txt file.

I see...

>     I think we are in the second case, brace expansion and after that
> filename generation. 

I think they're are took literally. If a type 'grep something $FOO/^*txt' or
the solution you gave me above, the filenames are generated when Tab is
pressed, but not in the case of the braces, it seems they're are ignored
after the ^ operator.

> See if you have dupes in the generated file list

It works great ;), thanks for your help.


-- 
David Gómez

"The question of whether computers can think is just like the question of
whether submarines can swim." -- Edsger W. Dijkstra


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

* Re: Question about extended globbing
  2003-11-23  9:09   ` David Gómez
@ 2003-11-23 10:10     ` DervishD
  2003-11-24 16:03       ` David Gómez
  0 siblings, 1 reply; 5+ messages in thread
From: DervishD @ 2003-11-23 10:10 UTC (permalink / raw)
  To: David Gómez; +Cc: Zsh-users

    Hi David :)

 * Davilín <david@pleyades.net> dixit:
> >     I think we are in the second case, brace expansion and after that
> > filename generation. 
> I think they're are took literally.

    Not, at least not for me: two lists, with the appropriate pattern
removed, are generated.

> If a type 'grep something $FOO/^*txt' or
> the solution you gave me above, the filenames are generated when Tab is
> pressed, but not in the case of the braces, it seems they're are ignored
> after the ^ operator.

    Then you don't have RC_EXPAND_PARAM set. That way, you get:

    grep $FOO^*txt *info

    after the expansion, prior to filename generation ;)
 
    Raúl Núñez de Arenas Coronado

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


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

* Re: Question about extended globbing
  2003-11-23 10:10     ` DervishD
@ 2003-11-24 16:03       ` David Gómez
  0 siblings, 0 replies; 5+ messages in thread
From: David Gómez @ 2003-11-24 16:03 UTC (permalink / raw)
  To: Zsh-users

Hi Raúl ;),

> > If a type 'grep something $FOO/^*txt' or
> > the solution you gave me above, the filenames are generated when Tab is
> > pressed, but not in the case of the braces, it seems they're are ignored
> > after the ^ operator.
> 
>     Then you don't have RC_EXPAND_PARAM set. That way, you get:

I didn't know that option ;)... Ok, i just have found it in the
documentation, so i'll give it a look.

Thanks :)

-- 
David Gómez

"The question of whether computers can think is just like the question of
whether submarines can swim." -- Edsger W. Dijkstra


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

end of thread, other threads:[~2003-11-24 16:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-22 23:55 Question about extended globbing David Gómez
2003-11-23  0:22 ` DervishD
2003-11-23  9:09   ` David Gómez
2003-11-23 10:10     ` DervishD
2003-11-24 16:03       ` David Gómez

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