9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Find command
@ 1998-09-02 21:02 Tom
  0 siblings, 0 replies; 12+ messages in thread
From: Tom @ 1998-09-02 21:02 UTC (permalink / raw)


On Sep 2,  4:28pm, Russ Cox wrote:
> fn xargs {
> 	while(a=`{read})
> 		$* $a
> }
>
> du -a | xargs ls -l

More straightforwardly, this is

	for(a in `{du -a}) ls -l $a

But, since du -a gives two fields on each line,
only one of which is interesting, you need to write

	for(a in `{du -a|awk '{print $2}'}) ls -l $a

or, since ls already loops over its arguments

	ls -l `{du -a|awk '{print $2}'}

-- 
Tom Duff.  It may be inelegant and sluglike, but bloatware sells.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [9fans] Find command
@ 1998-09-07 12:31 Roger
  0 siblings, 0 replies; 12+ messages in thread
From: Roger @ 1998-09-07 12:31 UTC (permalink / raw)


> it's limited to TSTKSIZ*BY2PG during the transfer between images,
> but it would be better to remove the restriction than to reinstate xargs.

actually, i would have thought that xargs (in its most simple incarnation)
would be more useful and reliable under plan 9 than unix, as at least
you're guaranteed that filenames don't have spaces in them.

at least it means when doing a large recursive grep, there's a reasonable
probability that it'll find something before traversing the entire
directory tree...

  rog.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [9fans] Find command
@ 1998-09-03 14:23 jmk
  0 siblings, 0 replies; 12+ messages in thread
From: jmk @ 1998-09-03 14:23 UTC (permalink / raw)


in plan9, TSTKSIZ on the x86 is rather small (10) and located awkwardly in
the address space - you can't increase it without also moving the location of
the user stack and there are some places this value is known (e.g. the alef
runtime):

	#define	USERADDR	0xC0000000		/* struct User */
	#define	TSTKTOP		USERADDR		/* end of new stack in sysexec */
	#define TSTKSIZ 	10
	#define	USTKTOP		(TSTKTOP-TSTKSIZ*BY2PG)	/* byte just beyond user stack */

although i don't remember all the details, in order to increase
it a couple of years ago in brazil i moved things around a bit more:

	#define	KZERO		0x80000000		/* base of kernel address space */
	#define	USTKTOP		(KZERO-BY2PG)		/* byte just beyond user stack */
	#define	TSTKTOP		(USTKTOP-USTKSIZE)	/* end of new stack in sysexec */
	#define TSTKSIZ 	100

this was fun as we were running a user-level ip implementation written in alef
at the time.

--jim

------ forwarded message follows ------

>From cse.psu.edu!owner-9fans Thu Sep  3 03:42:27 EDT 1998
Received: from plan9.bell-labs.com ([135.104.9.2]) by plan9; Thu Sep  3 03:42:27 EDT 1998
Received: from cse.psu.edu ([130.203.3.50]) by plan9; Thu Sep  3 03:42:26 EDT 1998
Received: from localhost (majordom@localhost) by cse.psu.edu (8.8.8/8.7.3) with SMTP id DAA10884; Thu, 3 Sep 1998 03:21:08 -0400 (EDT)
Received: by claven.cse.psu.edu (bulk_mailer v1.5); Thu, 3 Sep 1998 03:21:01 -0400
Received: (from majordom@localhost) by cse.psu.edu (8.8.8/8.7.3) id DAA10853 for 9fans-outgoing; Thu, 3 Sep 1998 03:20:56 -0400 (EDT)
X-Authentication-Warning: claven.cse.psu.edu: majordom set sender to owner-9fans using -f
Received: from caldo.demon.co.uk (none@caldo.demon.co.uk [194.222.207.148]) by cse.psu.edu (8.8.8/8.7.3) with SMTP id DAA10849 for <9fans@cse.psu.edu>; Thu, 3 Sep 1998 03:20:52 -0400 (EDT)
From: forsyth@caldo.demon.co.uk
Message-Id: <199809030720.DAA10849@cse.psu.edu>
To: 9fans@cse.psu.edu
Date: Thu, 3 Sep 1998 08:19:56 BST
Subject: Re: [9fans] Find command
Sender: owner-9fans@cse.psu.edu
Reply-To: 9fans@cse.psu.edu
Precedence: bulk

>>The only limit on arglist size in plan 9 is
>>total virtual memory available.

it's limited to TSTKSIZ*BY2PG during the transfer between images,
but it would be better to remove the restriction than to reinstate xargs.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [9fans] Find command
@ 1998-09-03  7:19 forsyth
  0 siblings, 0 replies; 12+ messages in thread
From: forsyth @ 1998-09-03  7:19 UTC (permalink / raw)


>>The only limit on arglist size in plan 9 is
>>total virtual memory available.

it's limited to TSTKSIZ*BY2PG during the transfer between images,
but it would be better to remove the restriction than to reinstate xargs.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [9fans] Find command
@ 1998-09-02 23:20 Tom
  0 siblings, 0 replies; 12+ messages in thread
From: Tom @ 1998-09-02 23:20 UTC (permalink / raw)


On Sep 2,  5:20pm, Scott Schwartz wrote:
> "Tom Duff" <td@pixar.com> writes:
> | or, since ls already loops over its arguments
>
> The main pitfall of the backquote operatator is that there's a limit on
> the size of argv. Hence xargs.

The only limit on arglist size in plan 9 is
total virtual memory available.  I have
trouble believing that any serious application
has ever exceeded that.  Hence plan 9 is
delivered sans xargs.

-- 
Tom Duff.  Void where prohibited.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [9fans] Find command
@ 1998-09-02 21:20 Scott
  0 siblings, 0 replies; 12+ messages in thread
From: Scott @ 1998-09-02 21:20 UTC (permalink / raw)


"Tom Duff" <td@pixar.com> writes:
| or, since ls already loops over its arguments

The main pitfall of the backquote operatator is that there's a limit on
the size of argv. Hence xargs.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [9fans] Find command
@ 1998-09-02 20:35 Ed
  0 siblings, 0 replies; 12+ messages in thread
From: Ed @ 1998-09-02 20:35 UTC (permalink / raw)



Try:

du -a | grep <regular expression> | awk '{print $2}'

to list file names matching regular expression.

rc scripts are also available but they seem much slower.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [9fans] Find command
@ 1998-09-02 20:33 Tom
  0 siblings, 0 replies; 12+ messages in thread
From: Tom @ 1998-09-02 20:33 UTC (permalink / raw)



--PART-BOUNDARY=.19809021333.ZM4832.marvin
Content-Description: Text
Content-Type: text/plain ; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Zm-Decoding-Hint: mimencode -q -u 

On Sep 2,  4:44pm, Franklin Robert Araujo Fran=E7a wrote:
>   In Plan 9, how can I use the command:
>
>         find . -print -exec ls -l {} \

This is roughly what you're after:

	ls -l `{du -a|awk '{print $2}'}

In general, du -a is often a good substitute for find.

-- =

Tom Duff.  Use at your own risk.

--PART-BOUNDARY=.19809021333.ZM4832.marvin--





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [9fans] Find command
@ 1998-09-02 20:30 Russ
  0 siblings, 0 replies; 12+ messages in thread
From: Russ @ 1998-09-02 20:30 UTC (permalink / raw)


actually i guess that should be
du -a | awk '{print $2}' | xargs ls -l 

sorry about that.
in general, find is very difficult.
du -a is usually good enough.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [9fans] Find command
@ 1998-09-02 20:28 Russ
  0 siblings, 0 replies; 12+ messages in thread
From: Russ @ 1998-09-02 20:28 UTC (permalink / raw)


fn xargs {
	while(a=`{read})
		$* $a
}

du -a | xargs ls -l





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [9fans] Find command
@ 1998-09-02 20:18 presotto
  0 siblings, 0 replies; 12+ messages in thread
From: presotto @ 1998-09-02 20:18 UTC (permalink / raw)


How about du -a?




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [9fans] Find command
@ 1998-09-02 19:44 Franklin
  0 siblings, 0 replies; 12+ messages in thread
From: Franklin @ 1998-09-02 19:44 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 227 bytes --]

    In Plan 9, how can I use the command:

        find . -print -exec ls -l {} \

    Because,  Plan 9 don´t have the command find. Someone already
implemented the command find in Plan 9?

Thanks.

Franklin.





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1998-09-07 12:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-02 21:02 [9fans] Find command Tom
  -- strict thread matches above, loose matches on Subject: below --
1998-09-07 12:31 Roger
1998-09-03 14:23 jmk
1998-09-03  7:19 forsyth
1998-09-02 23:20 Tom
1998-09-02 21:20 Scott
1998-09-02 20:35 Ed
1998-09-02 20:33 Tom
1998-09-02 20:30 Russ
1998-09-02 20:28 Russ
1998-09-02 20:18 presotto
1998-09-02 19:44 Franklin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).