Unix Shell - Do not find those files, but it does.

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > August 2007 > Do not find those files, but it does.





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]

Author Do not find those files, but it does.
Atropo

2007-08-24, 1:24 pm

Hi all.

AFAIK. this should not bring me .out files. but I'm not expert. do you
see something wrong?

$ find . ! -name "*.out" -exec ls -l {} \;

after I took off "

$ find . ! -name *.out -exec ls -l {} \;

and shows ksh: /bin/find: 0403-027 The parameter list is too long.

someone told me that find do not have the limitations of " ls" and
would not thrown this error.

KSH on AIX5.2

John DuBois

2007-08-24, 1:24 pm

In article <1187965310.953741.21470@q4g2000prc.googlegroups.com>,
Atropo <lxvasquez@gmail.com> wrote:
>AFAIK. this should not bring me .out files. but I'm not expert. do you
>see something wrong?
>
>$ find . ! -name "*.out" -exec ls -l {} \;


This will run ls on each directory that is found. If any such directory
contains a *.out file, ls will list it. To avoid this, add -d to the ls
arguments (ls -l -d ...).

>after I took off "
>
>$ find . ! -name *.out -exec ls -l {} \;
>
>and shows ksh: /bin/find: 0403-027 The parameter list is too long.
>
>someone told me that find do not have the limitations of " ls" and
>would not thrown this error.


This isn't a limitation of find, ls, or ksh; it's a limitation in the size of
the argument list that can be passed to a process. By quoting *.out, you
prevent the shell from expanding it into a large list to pass to find; instead
find uses the pattern itself to determine what files (not) to list.

John
--
John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/
Bill Marcum

2007-08-24, 1:24 pm

On Fri, 24 Aug 2007 15:25:02 -0000, John DuBois
<spcecdt@armory.com> wrote:
>
>
> In article <1187965310.953741.21470@q4g2000prc.googlegroups.com>,
> Atropo <lxvasquez@gmail.com> wrote:
>
> This will run ls on each directory that is found. If any such directory
> contains a *.out file, ls will list it. To avoid this, add -d to the ls
> arguments (ls -l -d ...).
>

Or add "-type f" to the find arguments.


--
Sometimes, too long is too long.
-- Joe Crowe
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com