|
Home > Archive > Unix administration > March 2005 > find and list
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| How do I so a search and then display in ls -l format
find / -name test.txt ....
| |
| Dave Hinz 2005-03-10, 6:00 pm |
| On Thu, 10 Mar 2005 12:16:10 -0800, tony <none@none.com> wrote:
> How do I so a search and then display in ls -l format
>
> find / -name test.txt ....
man find. You might want to look at the 'exec' section of the manpage.
| |
|
| On 10 Mar 2005 20:33:17 GMT, Dave Hinz <DaveHinz@spamcop.net> wrote:
>On Thu, 10 Mar 2005 12:16:10 -0800, tony <none@none.com> wrote:
>
>man find. You might want to look at the 'exec' section of the manpage.
Easier said than done. I had to do a google search to refresh my memory.
for linux:
find / -name test.txt -exec ls -l {} \;
for real unix, you might have to escape the { and } ( use \{ and \} )
| |
| S. Anthony Sequeira 2005-03-10, 6:00 pm |
| On Thu, 2005-03-10 at 15:28 -0600, TCS wrote:
> for linux:
> find / -name test.txt -exec ls -l {} \;
>
> for real unix, you might have to escape the { and } ( use \{ and \} )
>
>
Are you posting from Joe's Garage? ;)
Real unix?
GNU find has the -ls action.
find / -name test.txt -ls
--
I must rule with eye and claw -- as the hawk among lesser birds.
-- DUKE PAULUS ATREIDES, The Atreides Assertion
| |
| Dragan Cvetkovic 2005-03-10, 6:00 pm |
| "S. Anthony Sequeira" <tony@sequeira.org.uk> writes:
> On Thu, 2005-03-10 at 15:28 -0600, TCS wrote:
>
> Are you posting from Joe's Garage? ;)
>
> Real unix?
>
> GNU find has the -ls action.
>
> find / -name test.txt -ls
Or even better
find / -name test.txt | xargs ls -l
--
Dragan Cvetkovic,
To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer
!!! Sender/From address is bogus. Use reply-to one !!!
| |
| Greg Beeker 2005-03-10, 6:00 pm |
|
Dragan Cvetkovic wrote:
> "S. Anthony Sequeira" <tony@sequeira.org.uk> writes:
>
\} )[vbcol=seagreen]
>
> Or even better
>
> find / -name test.txt | xargs ls -l
I beg to differ, but I find that one command is always less load on the
system, than two commands separated by a pipe symbol. So this is the
case where 'less' is 'more' better. IMHO.
>
> --
> Dragan Cvetkovic,
>
> To be or not to be is true. G. Boole No it isn't. L. E. J.
Brouwer
>
> !!! Sender/From address is bogus. Use reply-to one !!!
| |
| Kevin Collins 2005-03-10, 6:00 pm |
| In article <1110493330.502984.212580@o13g2000cwo.googlegroups.com>, Greg Beeker
wrote:
>
> Dragan Cvetkovic wrote:
> \} )
>
> I beg to differ, but I find that one command is always less load on the
> system, than two commands separated by a pipe symbol. So this is the
> case where 'less' is 'more' better. IMHO.
Well, beggars can't be choosers as the saying goes If you don't have the
'-ls' option, then the xargs route will almost certainly be more efficient than
using the '-exec' which forks a child process for each file found...
Kevin
| |
| Barry Margolin 2005-03-11, 2:48 am |
| In article <slrnd31jbd.gb7.spamtotrash@halo.unix-guy.com>,
Kevin Collins <spamtotrash@toomuchfiction.com> wrote:
> In article <1110493330.502984.212580@o13g2000cwo.googlegroups.com>, Greg
> Beeker
> wrote:
>
> Well, beggars can't be choosers as the saying goes If you don't have the
> '-ls' option, then the xargs route will almost certainly be more efficient
> than
> using the '-exec' which forks a child process for each file found...
>
> Kevin
-ls is a standard option to find, it's not a GNUism.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
| |
| Chris F.A. Johnson 2005-03-11, 2:48 am |
| On Fri, 11 Mar 2005 at 03:26 GMT, Barry Margolin wrote:
>
> -ls is a standard option to find, it's not a GNUism.
It's in some other versions besides GNU, but it's not in many older
ones, and it's not in the POSIX spec.
--
Chris F.A. Johnson http://cfaj.freeshell.org/shell
========================================
===========================
My code (if any) in this post is copyright 2005, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
| |
| Constantin Wiemer 2005-03-11, 2:48 am |
| TCS wrote:
> for linux:
> find / -name test.txt -exec ls -l {} \;
>
> for real unix, you might have to escape the { and } ( use \{ and \} )
What you have to escape and what not depends on the shell you're using
and not on the specific flavor of UNIX.
Regards,
Constantin Wiemer
| |
| Kevin Collins 2005-03-11, 5:59 pm |
| In article <39cijnF61p47sU1@individual.net>, Chris F.A. Johnson wrote:
> On Fri, 11 Mar 2005 at 03:26 GMT, Barry Margolin wrote:
>
> It's in some other versions besides GNU, but it's not in many older
> ones, and it's not in the POSIX spec.
Its not on HP-UX up through the current version of 11.23...
Kevin
| |
| Barry Margolin 2005-03-11, 8:55 pm |
| In article <39cijnF61p47sU1@individual.net>,
"Chris F.A. Johnson" <cfajohnson@gmail.com> wrote:
> On Fri, 11 Mar 2005 at 03:26 GMT, Barry Margolin wrote:
>
> It's in some other versions besides GNU, but it's not in many older
> ones, and it's not in the POSIX spec.
I've been using Unix for over 20 years and it seems like it's always
been there. Maybe it was a BSDism or SunOSism?
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
| |
| Doug Freyburger 2005-03-13, 5:51 pm |
| Barry Margolin wrote:
> Chris F.A. Johnson wrote:
>
>
>
> I've been using Unix for over 20 years and it seems like it's always
> been there. Maybe it was a BSDism or SunOSism?
I'ts missing on HPUX and AIX to this day, and both
of those predate the unification of SYSV and BSD
by Sun. I started using UNIX of VAX BSD 4.(1,2,3)
and it wasn't in 4.1 or 4.2. I didn't use 4.3 until
I also used SunOS 3.2. So I do think it is either
originally from Sun or BSD but I don't remember
which.
Find is one of the sysdmin wonder programs. It is
well worth spending the time to learn its binary
logic tree command line style. It's also worth
ignoring a convenient feature like -ls that isn't
present on all common versions, but not because it
is missing on some versions. The reason for ignoring
it while learning to use find: Also learning the
use of xargs. Combining find and xargs unleashes
the power of toolsmithing.
| |
| Greg Beeker 2005-03-14, 5:57 pm |
|
Doug Freyburger wrote:
> Barry Margolin wrote:
older[vbcol=seagreen]
always[vbcol=seagreen]
>
> I'ts missing on HPUX and AIX to this day, and both
I run aix 433, 51, and 52 and the -ls option to find *is* on all these
versions.
> of those predate the unification of SYSV and BSD
> by Sun. I started using UNIX of VAX BSD 4.(1,2,3)
> and it wasn't in 4.1 or 4.2. I didn't use 4.3 until
> I also used SunOS 3.2. So I do think it is either
> originally from Sun or BSD but I don't remember
> which.
>
> Find is one of the sysdmin wonder programs. It is
> well worth spending the time to learn its binary
> logic tree command line style. It's also worth
> ignoring a convenient feature like -ls that isn't
> present on all common versions, but not because it
> is missing on some versions. The reason for ignoring
> it while learning to use find: Also learning the
> use of xargs. Combining find and xargs unleashes
> the power of toolsmithing.
This is true. If I didn't start to learn about xargs until I began to
administer both AIX and SUN systems. Now it's invaluable for combining
the output of a command, with a specially formatted input to another
command.
|
|
|
|
|