Subject: Re: stat(1) and find(1)
To: Andrew Brown <atatat@atatdot.net>
From: David Laight <david@l8s.co.uk>
List: tech-userlevel
Date: 07/22/2003 15:10:12
On Tue, Jul 22, 2003 at 01:20:22AM -0400, Andrew Brown wrote:
> i was thinking of of rearranging stat(1)'s source code a little so
> that other programs could include the formatting code with very little
> difficulty.
> 
> one such candidate would be find(1), so that you could do things like:
> 
> 	find . -type f -stat "%m %N" | sort -n | tail -5
> 
> for example, and find the five newest files under a given directory.
> there would, of course, be a -stat0 operator, and these would satisfy
> the "print something by default" requirement that find asserts.
> 
> it's terribly non-standard, of course, but it might also terribly
> useful.
> 
> comments?  opinions?  criticisms?  flames?

Doesn't look necessary to me.
Just use xargs:

	find . -type f | xargs stat "%m %N" | sort -n | tail -5

is probably about the same.

It doesn't seem worth adding lots of other ways to do '-print' to
find, that is what pipelines are for!

	David

-- 
David Laight: david@l8s.co.uk