From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <97923860131552.tru64-unix-managers.marc@archive.invalid> From: "Strong, Rick \(Maxim\)" Date: Thu, 11 Jan 2001 18:42:19 +0000 To: tru64-unix-managers Subject: SUMMARY: Argument limits on mv, awk, ls X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=97923860131552 All, Several good suggestions, which I will be exploring. Thanks! 1. Several pointed me to xargs: a. "That's good old ARG_MAX. You can work around this using xargs, as in: 'find . -name foo\* | xargs rm'. See the man page on xargs for details." b. "One limit you might hit is ARG_MAX. From the exec(2) manpage: The exec functions set errno to the specified values for the following con=ADditions:[E2BIG] The number of bytes used by the new process = image's argument list and environment list is greater than ARG_MAX bytes. /usr/include/sys/syslimits.h #defines ARG_MAX to 38912 bytes on my system.The problem occurs when the shell expands a pattern in a large directory? In this case one can often use find and xargs similar to: = 'find . -name 'pattern' -print |xargs command' c. "The xargs program is typically used to solve this although there are other solutions with awk such as reading the arguments from a regular file or "here" file." d. "use xargs for mv ls; use perl in place of awk" e. "check out xargs." 2. One mentioned ulimit:=20 "If you are doing something like: 'mv * xx' then you are probably = exceeding the stack size. Use 'ulimit -H -a' to see what the hard limits are. = Also need to check 'ulimit -S -a', as they may be lower. Use 'ulimit -s = nnnnn' to change the stack limits." 3. A couple of 'for' loop solutions:=20 a. "I came across a limit on "rm"... went with: 'for i in `ls` do rm $i done' b. "The solution was to do something like this: 'ls | grep somepattern > /tmp/junk.lis' and then parse thru junk.lis with a for = loop (in Bourne shell)." Rick Strong EDS MCI Production Support