Computing.Net > Forums > Unix > Parameter list too long

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Parameter list too long

Reply to Message Icon

Name: Steve Stack
Date: May 14, 2003 at 11:19:17 Pacific
OS: AIX
CPU/Ram: 5.1
Comment:

Is there a way to get around the MAX_ARGS in the limits.h file? I'm attempting to do a "word count" and keep getting the message saying the parameter list is too long. Here is an example of the command:
ls myfile.* | wc -l.

Can the find command or any other command be used to count the number of files in a certain dir with a certain prefix.

Thanks for any help.

Steve Stack
sstack@humana.com




Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: May 14, 2003 at 14:20:38 Pacific
Reply:

Steve:

The problem is you are overflowing the command-line buffer. Typically, the xargs, construct argument lists, command sends only enough arguments so as to not overflow. Check out if this fixes your problem:

ls myfile.*|xargs ls |wc -l

Regards,

nails


0

Response Number 2
Name: propyl
Date: May 23, 2003 at 16:15:49 Pacific
Reply:

The solution is to use "find" not "ls". This method will work for any number of files and is better working practice:

find . -name myfile\.\* -print | wc -l

The backslash before the "." is to make "find" read the "." as a character not a wildcard. The backslash before the "*" is to stop shell expanding the "*".


0

Response Number 3
Name: nails
Date: May 29, 2003 at 10:01:26 Pacific
Reply:

I must respectfully disagree with you. You can overflow the command line with find as well as ls. That's the beauty of xargs - it won't.

In addition, find searches the directory structure which may or may not be what the original poster wants to do.

Regards,


Nails


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Parameter list too long

The parameter list is too long (AIX) www.computing.net/answers/unix/the-parameter-list-is-too-long-aix/2584.html

The parameter list is too long www.computing.net/answers/unix/the-parameter-list-is-too-long/3585.html

Parameter list is too long for tar www.computing.net/answers/unix/parameter-list-is-too-long-for-tar/3876.html