in reply to VVP:Perl oneliners for Unix commands

Off topic, but a pure UNIX solution might be:
ls | grep '^Q\.PACES'

Updated Now I escape the literal period in the regex.

Update 2: I'm convinced that some of the other solutions will NOT work, including echo Q.PACES* and any Perl solution involving <Q.PACES*>. If the shell can't handle filename completion one way, it won't work another way either.
Further testing shows that this depends on your shell and your version of Perl. Your mileage may vary...

buckaduck

Replies are listed 'Best First'.
Re: Re: VVP:Perl oneliners for Unix commands
by derby (Abbot) on Mar 13, 2002 at 19:53 UTC
    buckaduck,

    The <Q.PACES*> will work in more instances than anything that that uses shell metacharacters. There are possible two limits you can reach here - the size of the command line your shell can read and two, the maximum number of arguments your exec can handle (getconf ARG_MAX). Most shells will bomb out because you reach the max for the command line buffer (expansion first by shell then exec). For those that don't hard code the cl buffer, you're going to hit the exec max.

    The perlfunc:glob function used to use csh to do it's trick but now it uses File::Glob to do it's work. Since that is is based on the bsd glob (man 3 glob) it should work up to your max mem (or there about).

    That being said, you do need to be careful using glob and the solutions that minimize memory (find, ls | grep, etc) are probably much better implementations if you're going to be doing a lot of this thing.

    -derby

Re: Re: VVP:Perl oneliners for Unix commands
by Felonious (Chaplain) on Mar 15, 2002 at 03:05 UTC
    To do it using the shell, try this:
    echo Q.PACES* | xargs ls
    -- O thievish Night, Why should'st thou, but for some felonious end, In thy dark lantern thus close up the stars? --Milton