tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: Argument limits on mv, awk, ls
@ 2001-01-11 18:42 Strong, Rick (Maxim)
  0 siblings, 0 replies; only message in thread
From: Strong, Rick (Maxim) @ 2001-01-11 18:42 UTC (permalink / raw)
  To: tru64-unix-managers

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-01-11 18:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-11 18:42 SUMMARY: Argument limits on mv, awk, ls Strong, Rick (Maxim)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox