From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Subject: Re: Plan 9 annoyances (was: Re: [9fans] mv vs cp) In-reply-to: Your message of "Tue, 09 Oct 2001 11:55:04 +0100." <20011009104245.DE77F19A0F@mail.cse.psu.edu> Message-ID: <17563.1002628227@apnic.net> From: George Michaelson Date: Tue, 9 Oct 2001 21:50:27 +1000 Topicbox-Message-UUID: 02f8f4ce-eaca-11e9-9e20-41e7f4b1d025 > > > i've missed find several times. xargs always struck me as > > > compensating for poor shell design. > > > > Isn't the problem the argv limits of number of characters and number of > > words? > > i don't think so entirely... > > for instance if i want to grep through an entire source tree, > i don't want to wait until the tree has been traversed completely > before the text searching begins. using > > du -a . | awk '{print $2}' | xargs grep pattern > > often gives me results much faster than > > grep pattern `{du -a . | awk '{print $2}'} > if you had a way to unblock/buffer the pipe, would the diffence be that great? That aside, I suspect I prefer the xargs one because my frontal lobes are wired for linear tape-processing methods, and the second one requires understanding function theory and/or two passes to parse the nested clause. > the latter usually works. i don't know what the kernel > limit is on command-line arguments, but it's more than sufficient > to pass all the source files in /sys/src (6764 files, ~160K). > > rog. Ie if you deliberately avoid the glob expansion problems which bedevill ls * | do a bunch of stuff you don't need find in flat spaces. xargs is cheap to implement in a shellscript and I have done that too, because I didn't know xargs existed for a long time. Likewise I use awk '{print $fieldnum}' because I didn't know cut existed, and my erstwhile younger and wiser heads find me laughably inept at shell these days. So is this yet another iteration of 'why write a command when you can write a script' ? -George PS amusingly enough, the same year I was learning about v7 on a pdp11 in Leeds, I had an Armenian guy try and convince me PICK was the way of the future, and that all coming filesystems would be database abstraction. I suppose if I'd been malleable enough I'd have bought that too. Still, we all laughed at the head of department for being a laser physicist. "What could *he* know about computing?" we said. And more fool us... -- George Michaelson | APNIC Email: ggm@apnic.net | PO Box 2131 Milton QLD 4064 Phone: +61 7 3367 0490 | Australia Fax: +61 7 3367 0482 | http://www.apnic.net