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
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.
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.
Summary: I have a problem with the command : tar cvf - `ls | grep -v "TAR" | grep -v "DMP" | xargs`| compress -c > file.Z error 0403-027 the parameter list is too long There is more on thousand files in the di...
Summary: I want to perform a simple rm command on all the files (#600) in a particular directory. When I try rm * I get the error: The parameter list is too long. I've tried to use xargs -n10000 rm but now m...
Summary: Hi Buddies, I tried to tar files from a directory to a tape device. The directory has more than 1000 files and I got the error message for parameter list is too long The script is as follows : su - e...