Parameter list is too long - Aix

This is a discussion on Parameter list is too long - Aix ; Hi all When below message prompted. Is it setup user memory by individual user ? AIX 5.2 # ls *.p > $HOME/abc.txt ksh: /usr/bin/ls: 0403-027 The parameter list is too long. moonhk...

+ Reply to Thread
Results 1 to 9 of 9

Thread: Parameter list is too long

  1. Parameter list is too long

    Hi all
    When below message prompted. Is it setup user memory by individual
    user ?

    AIX 5.2

    # ls *.p > $HOME/abc.txt
    ksh: /usr/bin/ls: 0403-027 The parameter list is too long.

    moonhk

  2. Re: Parameter list is too long

    On Apr 22, 7:25*am, moonhkt wrote:
    > Hi all
    > When below message prompted. Is it setup user memory by individual
    > user ?
    >
    > AIX 5.2
    >
    > # ls *.p > $HOME/abc.txt
    > ksh: /usr/bin/ls: 0403-027 The parameter list is too long.
    >
    > moonhk


    Pls use ls *.p | xargs > $HOME/abc.txt
    hth
    Ashok Sangra

  3. Re: Parameter list is too long

    On Apr 22, 10:30 am, Ashok Sangra wrote:
    > On Apr 22, 7:25 am, moonhkt wrote:
    >
    > > Hi all
    > > When below message prompted. Is it setup user memory by individual
    > > user ?

    >
    > > AIX 5.2

    >
    > > # ls *.p > $HOME/abc.txt
    > > ksh: /usr/bin/ls: 0403-027 The parameter list is too long.

    >
    > > moonhk

    >
    > Pls use ls *.p | xargs > $HOME/abc.txt


    It will not help since the "*" from " ls *.p " get expanded by the
    shell first. Thus the command which will be executed will be something
    like
    $ ls file1.p file2.p ... fileN.p
    And if the parameter list is too long you get a Parameter list is too
    long :-)

    A solution would be:
    $ ls | grep "\.p$"

    cheers
    Hajo


  4. Re: Parameter list is too long

    On 22 Apr., 10:53, Hajo Ehlers wrote:
    > On Apr 22, 10:30 am, Ashok Sangra wrote:
    >
    > > On Apr 22, 7:25 am, moonhkt wrote:

    >
    > > > Hi all
    > > > When below message prompted. Is it setup user memory by individual
    > > > user ?

    >
    > > > AIX 5.2

    >
    > > > # ls *.p > $HOME/abc.txt
    > > > ksh: /usr/bin/ls: 0403-027 The parameter list is too long.

    >
    > > > moonhk

    >
    > > Pls use ls *.p | xargs > $HOME/abc.txt

    >
    > It will not help since the "*" from " ls *.p " get expanded by the
    > shell first. Thus the command which will be executed will be something
    > like
    > $ ls file1.p file2.p ... fileN.p
    > *And if the parameter list is too long you get a Parameter list is too
    > long :-)
    >
    > A solution would be:
    > $ ls | grep "\.p$"
    >
    > cheers
    > Hajo



    or "find . -name \*.p > SOMEFILE"

    if you mind, you can also increase the ARG_MAX (a posix system wide
    configuration parameter)
    see "getconf ARG_MAX",
    which is the memory every process has set aside for cmdline arguments
    and environment variables, defaults to 24k on aix

    change it globally with "smit chgsys" -> "ARG/ENV list size"
    but be aware that every new process will consume the additional memory
    you specify.

    Joachim

  5. Re: Parameter list is too long

    On Apr 22, 2:13*pm, Joachim Gann wrote:
    > On 22 Apr., 10:53, Hajo Ehlers wrote:
    >
    >
    >
    >
    >
    > > On Apr 22, 10:30 am, Ashok Sangra wrote:

    >
    > > > On Apr 22, 7:25 am, moonhkt wrote:

    >
    > > > > Hi all
    > > > > When below message prompted. Is it setup user memory by individual
    > > > > user ?

    >
    > > > > AIX 5.2

    >
    > > > > # ls *.p > $HOME/abc.txt
    > > > > ksh: /usr/bin/ls: 0403-027 The parameter list is too long.

    >
    > > > > moonhk

    >
    > > > Pls use ls *.p | xargs > $HOME/abc.txt

    >
    > > It will not help since the "*" from " ls *.p " get expanded by the
    > > shell first. Thus the command which will be executed will be something
    > > like
    > > $ ls file1.p file2.p ... fileN.p
    > > *And if the parameter list is too long you get a Parameter list is too
    > > long :-)

    >
    > > A solution would be:
    > > $ ls | grep "\.p$"

    >
    > > cheers
    > > Hajo

    >
    > or "find . -name \*.p > SOMEFILE"
    >
    > if you mind, you can also increase the ARG_MAX (a posix system wide
    > configuration parameter)
    > see "getconf ARG_MAX",
    > which is the memory every process has set aside for cmdline arguments
    > and environment variables, *defaults to 24k on aix
    >
    > change it globally with "smit chgsys" -> "ARG/ENV list size"
    > but be aware that every new process will consume the additional memory
    > you specify.
    >
    > Joachim- Hide quoted text -
    >
    > - Show quoted text -


    Thanks Hajo & Joachim for correcting me. That was indeed a bad
    solution. Thanks,
    -Ashok

  6. Re: Parameter list is too long

    On Apr 22, 11:13 am, Joachim Gann wrote:
    ....
    > or "find . -name \*.p > SOMEFILE"


    Which will also parse subdirectories as well. So it depends what the
    OP is really looking for.

    To the OP: You should keep in mind that a
    $ ls *.p
    will not only show files which end with ".p" but also the contents of
    ANY subdirectory ending with ".p" .

    Meaning that for example the following files and directories exist:
    a.p
    dir.p/
    dir.p/a.q

    a ls *.p will also show a.q. Might not what you are looking for.

    cheers
    Hajo

  7. Re: Parameter list is too long

    On Apr 22, 6:25 pm, Hajo Ehlers wrote:
    > On Apr 22, 11:13 am, Joachim Gann wrote:
    > ...
    >
    > > or "find . -name \*.p > SOMEFILE"

    >
    > Which will also parse subdirectories as well. So it depends what the
    > OP is really looking for.
    >
    > To the OP: You should keep in mind that a
    > $ ls *.p
    > will not only show files which end with ".p" but also the contents of
    > ANY subdirectory ending with ".p" .
    >
    > Meaning that for example the following files and directories exist:
    > a.p
    > dir.p/
    > dir.p/a.q
    >
    > a ls *.p will also show a.q. Might not what you are looking for.
    >
    > cheers
    > Hajo


    Thank
    ls | grep "\.p$" and setup chdev are ok.

  8. Re: Parameter list is too long

    check
    "moonhkt" wrote in message
    news:3e2c058d-2ac0-47b6-a8d0-ee203e962691@a9g2000prl.googlegroups.com...
    > Hi all
    > When below message prompted. Is it setup user memory by individual
    > user ?
    >
    > AIX 5.2
    >
    > # ls *.p > $HOME/abc.txt
    > ksh: /usr/bin/ls: 0403-027 The parameter list is too long.
    >
    > moonhk


    You should increse "ncargs" in sys (I believe default is 6):

    chdev -l sys0 -a ncargs=128

    I have my system set to 512 (4KB blocks).






  9. Re: Parameter list is too long

    One of the problems I see with adjusting ncargs or the ARG_MAX values
    is this: If you are writing a script that is to be used on multiple
    systems, all of the systems have to have that same change or else the
    script works on one box and not the other.

    And, if you happen to have so many files in your "ls *" command as to
    hit a "new" maximum argument limitation, you will be revisiting this
    error. Using xargs or the find command will allow you to have better
    control and a more acceptable shell script on alternate systems.

    I know...we ran into this problem when coding both a backup routine
    and a cleanup utility in the past. On our development and test
    servers, we had 800 files in a directory...no problems detected. When
    it was released to a production server that had 2400 files in the
    directory, we got "parameter list too long" and had to rethink the
    coding.


+ Reply to Thread