Re: Problems with find 4.2.27

2006-08-14 Thread dance
The remote file system is ext3.  Upgrading findutils fixed the problem.

Thank you for your time and assistance.


 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 According to [EMAIL PROTECTED] on 8/11/2006 5:52 PM:
 I've been having problems with find, and it's hard to search the
 entire
 mailing list for find since it's such a common word.  I don't know
 what
 cygwin package find comes in, so I can't search for that.

 cygcheck -p find.exe shows it is part of findutils.


 You'll notice that it showed a directory named 90s/no and a directory
 named 70s with no files in them.

 Try upgrading to findutils 4.3.0.  I suspect the leaf optimization is
 getting told a bad link count for the remote directories, and is then
 assuming it does not need to stat files to traverse into subdirectories.
 By upgrading, you will be using a newer algorithm in find that is less
 confused by these situations.

 If I try the same command from my Fedora 5 box, it complains that
 //192.168.200.9/public isn't a valid directory.

 That's because // notation is only special on cygwin.  POSIX allows it to
 be special, but most other Unix vendors treat it as synonymous with /.


 If I mount the network on my windows XP machine, and use the cygwin find
 on the mounted drive, it has the same problem.

 Mounting on cygwin doesn't change the fact that the drive is remote, and
 that cygwin doesn't always know how to calculate link count for remote
 drives.  By the way, what type of filesystem is this?  Also, what version
 of cygwin are you using, as cygwin 1.5.21 contains code to make link count
 more reliable.  If you had followed directions,

 Problem reports:   http://cygwin.com/problems.html

 and sent the text output of `cygcheck -svr' as an attachment, we could
 have helped you better.

 - --
 Life is short - so eat dessert first!

 Eric Blake [EMAIL PROTECTED]
 volunteer cygwin findutils maintainer
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.2.1 (Cygwin)
 Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iD8DBQFE3ddF84KuGfSFAYARAqVzAKDOeCh+NWIoMjStkAQZbANjqRKvTACg2AI8
 VXWEIOgCubr9upLxn0tdok4=
 =XJ5P
 -END PGP SIGNATURE-

 --
 Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
 Problem reports:   http://cygwin.com/problems.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/




--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Problems with find 4.2.27

2006-08-12 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to [EMAIL PROTECTED] on 8/11/2006 5:52 PM:
 I've been having problems with find, and it's hard to search the entire
 mailing list for find since it's such a common word.  I don't know what
 cygwin package find comes in, so I can't search for that.

cygcheck -p find.exe shows it is part of findutils.

 
 You'll notice that it showed a directory named 90s/no and a directory
 named 70s with no files in them.

Try upgrading to findutils 4.3.0.  I suspect the leaf optimization is
getting told a bad link count for the remote directories, and is then
assuming it does not need to stat files to traverse into subdirectories.
By upgrading, you will be using a newer algorithm in find that is less
confused by these situations.

 If I try the same command from my Fedora 5 box, it complains that
 //192.168.200.9/public isn't a valid directory.

That's because // notation is only special on cygwin.  POSIX allows it to
be special, but most other Unix vendors treat it as synonymous with /.

 
 If I mount the network on my windows XP machine, and use the cygwin find
 on the mounted drive, it has the same problem.

Mounting on cygwin doesn't change the fact that the drive is remote, and
that cygwin doesn't always know how to calculate link count for remote
drives.  By the way, what type of filesystem is this?  Also, what version
of cygwin are you using, as cygwin 1.5.21 contains code to make link count
more reliable.  If you had followed directions,

 Problem reports:   http://cygwin.com/problems.html

and sent the text output of `cygcheck -svr' as an attachment, we could
have helped you better.

- --
Life is short - so eat dessert first!

Eric Blake [EMAIL PROTECTED]
volunteer cygwin findutils maintainer
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE3ddF84KuGfSFAYARAqVzAKDOeCh+NWIoMjStkAQZbANjqRKvTACg2AI8
VXWEIOgCubr9upLxn0tdok4=
=XJ5P
-END PGP SIGNATURE-

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Problems with FIND

2003-03-02 Thread David Means
'type' reporting the first instance of a file that it finds isn't a
problem.  However, I will assume that when you run the 'find' command,
that you're finding that the windows version of find is running and not
the cygwin version, and that's your problem.

The windows version of 'find' is found in your 'PATH' before the cygwin
version.  This can be solved in one of two ways.  You may edit your
system or user path (via the control panel) and put the cygwin paths
first in your system or user path.  However, I don't recommend this: it
might interfere with a windows program or operation.  Your second option
is to edit either /etc/profile or $HOME/.bash_login or
$HOME/.bash_profile, making sure that the cygwin paths are placed before
the default windows paths.  Specifically, you'd be wanting /usr/bin (if
I recall correctly; I don't have cygwin machine handy right now) first
in the path.  Once this is done, log out of cygwin, log back in and your
paths should be fixed.



On Sun, 2003-03-02 at 05:44, Fernando Bastos wrote:
 Hello,
 When I do 'type find', I pick up the Win find.exe. Well, how can I solve the
 problem? I am not expert enough and I could not find any information about
 that!
 Thanks a lot!
 
 Bastos
 ==
 Fernando João Pereira de Bastos
 e-mail: [EMAIL PROTECTED]
 ==
 
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 
 
 --
 Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
 Bug reporting: http://cygwin.com/bugs.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/
-- 
David Means

sed is ed on LSD 
-- Pat Becker


signature.asc
Description: This is a digitally signed message part


Re: Re: Problems with find

2003-02-05 Thread fj_br_
[EMAIL PROTECTED] schrieb am 31.01.03 16:47:10:
 
 For the archives: No.  This is not going to do what the OP wants at all.
 In fact, if there's more than one file named 1000.*, it won't even work
 (find will produce a find: paths must precede expression error).  For
 details, info find and info bash.
 
 To the OP: Is your 1000 directory a symbolic link, by any chance?  If it
 is, try the -follow option.  For details, info find.
   Igor
 
Thanks for the hint with -follow it worked, but the directory 1000 is not a symbolic 
link as you can see

$ find . -name 1000\* -follow
./1000.zip
./1000
./1000/1000.zip

$ ls -ld 1000
drwxr-xr-x2 f.braunb unknown 0 Jan 31 08:33 1000

$ ls -l 1000*
-rw-r--r--1 f.braunb unknown  162114808 Jan 30 14:57 1000.zip

1000:
total 158316
-rw-r--r--1 f.braunb unknown  162114808 Jan 31 08:33 1000.zip

Could this be a bug?


Franz


 On Fri, 31 Jan 2003, Carlo Florendo wrote:
 
  find . -name 1000.*
 
  - Original Message -
  From: [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Friday, January 31, 2003 5:57 PM
  Subject: Problems with find
 
 
  Hi folks,
 
  I trie to search file with find an didn't find all the file which should be
  found
 
  I search for all file starting with 1000 an the file 1000.zip in the
  diretory 1000 is not found
  $ find . -name 1000\*
  ./1000.zip
  ./1000
 
  but when I ls the directory 1000 the file is listed
  $ ls 1000
  1000.zip
 
  As you can see I use the find installed in /usr/bin
  $ which find
  /usr/bin/find
  $ type find
  find is hashed (/usr/bin/find)
 
 
  what is wrong? Is it a bug or my fault?
 
  Thanks for any help and hint
 
  Franz
 
 -- 
   http://cs.nyu.edu/~pechtcha/
   |\  _,,,---,,_  [EMAIL PROTECTED]
 ZZZzz /,`.-'`'-.  ;-;;,_  [EMAIL PROTECTED]
  |,4-  ) )-,_. ,\ (  `'-' Igor Pechtchanski
 '---''(_/--'  `-'\_) fL   a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!
 
 Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
   -- /usr/games/fortune
 
 
 --
 Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
 Bug reporting: http://cygwin.com/bugs.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/
 


__
Keine Chance für Viren! Mit WEB.DE FreeMail sind Sie auf der
sicheren Seite - Virenschutz inklusive! http://freemail.web.de/features/?mc=021129


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Re: Re: Problems with find

2003-02-05 Thread Randall R Schulz
Carlo,

At 08:35 2003-02-05, [EMAIL PROTECTED] wrote:

[EMAIL PROTECTED] schrieb am 31.01.03 16:47:10:

 For the archives: No.  This is not going to do what the OP wants at all.
 In fact, if there's more than one file named 1000.*, it won't even work
 (find will produce a find: paths must precede expression error).  For
 details, info find and info bash.

 To the OP: Is your 1000 directory a symbolic link, by any chance?  If it
 is, try the -follow option.  For details, info find.
   Igor

Thanks for the hint with -follow it worked, but the directory 1000 is 
not a symbolic link as you can see

$ find . -name 1000\* -follow
./1000.zip
./1000
./1000/1000.zip

$ ls -ld 1000
drwxr-xr-x2 f.braunb unknown 0 Jan 31 08:33 1000

$ ls -l 1000*
-rw-r--r--1 f.braunb unknown  162114808 Jan 30 14:57 1000.zip

1000:
total 158316
-rw-r--r--1 f.braunb unknown  162114808 Jan 31 08:33 1000.zip

Could this be a bug?

What bug are you suggesting? There's a directory named 1000 and it 
contains a file called 1000.zip. That's all very clear by what's 
shown here. Perhaps this situation arose earlier in your confusion 
about shell glob characters, find and whatnot.

Sometimes in circumstances like this, confusion can be reduced by using 
the -i option to ls. This will cause ls to include the inode number 
in its output. (This is not quite the same thing in Cygwin as in real 
Unix file systems, but it's there and serves the purpose of this hint.)

Distinct files that are otherwise identical and, beyond their full path 
names, indistinguishable (same name, size, modes, owners, etc.) will 
have different inode numbers. Likewise, hard links (possible with NTFS 
but not FATn) will have identical inode numbers even if their names are 
different. However, given that hard links are just multiple names for 
the same file, it's impossible to have any other file attribute differ 
between two hard links to the same file.

One last wrinkle to note is that if you attempt to create a hard link 
on a FAT file system volume, Cygwin will copy the file for you. That's 
its best-effort attempt to comply with a request that cannot literally 
be fulfilled but which is nonetheless required by POSIX compliance. 
(I'm presuming a bit here as to motivation for the fallback behavior 
for hard linking on FAT file systems.)

Randall Schulz


Franz


 On Fri, 31 Jan 2003, Carlo Florendo wrote:

  find . -name 1000.*
 
  - Original Message -
  From: [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Friday, January 31, 2003 5:57 PM
  Subject: Problems with find
 
 
  Hi folks,
 
  I trie to search file with find an didn't find all the file which 
should be
  found
 
  I search for all file starting with 1000 an the file 1000.zip in the
  diretory 1000 is not found
  $ find . -name 1000\*
  ./1000.zip
  ./1000
 
  but when I ls the directory 1000 the file is listed
  $ ls 1000
  1000.zip
 
  As you can see I use the find installed in /usr/bin
  $ which find
  /usr/bin/find
  $ type find
  find is hashed (/usr/bin/find)
 
 
  what is wrong? Is it a bug or my fault?
 
  Thanks for any help and hint
 
  Franz


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Re: Problems with find

2003-01-31 Thread Carlo Florendo
find . -name 1000.*

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 31, 2003 5:57 PM
Subject: Problems with find


Hi folks,

I trie to search file with find an didn't find all the file which should be
found

I search for all file starting with 1000 an the file 1000.zip in the
diretory 1000 is not found
$ find . -name 1000\*
./1000.zip
./1000

but when I ls the directory 1000 the file is listed
$ ls 1000
1000.zip

As you can see I use the find installed in /usr/bin
$ which find
/usr/bin/find
$ type find
find is hashed (/usr/bin/find)


what is wrong? Is it a bug or my fault?

Thanks for any help and hint

Franz

__
Ihnen fehlen die richtigen Worte für Ihre SMS? WEB.DE FreeMail hat die
besten Sprueche für Sie. http://freemail.web.de/features/?mc=021169


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Re: Problems with find

2003-01-31 Thread Thorsten Kampe
* [EMAIL PROTECTED] (03-01-31 09:57 +0100)
 I trie to search file with find an didn't find all the file which should be
 found
 
 I search for all file starting with 1000 an the file 1000.zip in the
 diretory 1000 is not found
 $ find . -name 1000\*

find -type f -name '1000*'

 ./1000.zip
 ./1000
 
 but when I ls the directory 1000 the file is listed
 $ ls 1000
 1000.zip

 [...]

 what is wrong? Is it a bug or my fault?

I cannot reproduce this so it's probably PEBCAC. You'd better ask in 
news:de.comp.os.unix.shell :
http://groups.google.com/groups?as_q=findnum=100as_scoring=rhl=deas_ugroup=de.comp.os.unix.shell

Thorsten
-- 
 Content-Type: text/explicit; charset=ISO-8859-666 (Parental Advisory)
 Content-Transfer-Warning: message contains innuendos not suited for
 children under the age of 18


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




RE: Problems with find

2003-01-31 Thread Ian R. Chesal
Your syntax is incorrect. Try:

find . -name 1000*

I just tried in in /tmp on my cygwin installation and here's the output:

$ find . -name 1000* -o -name 1000.*
./1000
./1000/1000.zip
./1000.tar.gz

You can limit the find to just files or directories with the -type flag.
Do 'info find' to learn more. The way you had the expression written
each conditional was joined with an implicit -a (and) so that find would
only print if all three evaluated to true. You wanted a -o (or) between
each pattern but really you can accomplish what you want with a quoted
pattern, which IMHO is a more straight-forward way to look for what you
want.

Ian

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf
Of [EMAIL PROTECTED]
Sent: January 31, 2003 3:57 AM
To: [EMAIL PROTECTED]
Subject: Problems with find


Hi folks,

I trie to search file with find an didn't find all the file which should
be found

I search for all file starting with 1000 an the file 1000.zip in the
diretory 1000 is not found $ find . -name 1000\* ./1000.zip ./1000

but when I ls the directory 1000 the file is listed
$ ls 1000
1000.zip

As you can see I use the find installed in /usr/bin
$ which find
/usr/bin/find
$ type find
find is hashed (/usr/bin/find)


what is wrong? Is it a bug or my fault?

Thanks for any help and hint

Franz

__
Ihnen fehlen die richtigen Worte für Ihre SMS? WEB.DE FreeMail hat die
besten Sprueche für Sie. http://freemail.web.de/features/?mc=021169


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Re: Problems with find

2003-01-31 Thread Igor Pechtchanski
For the archives: No.  This is not going to do what the OP wants at all.
In fact, if there's more than one file named 1000.*, it won't even work
(find will produce a find: paths must precede expression error).  For
details, info find and info bash.

To the OP: Is your 1000 directory a symbolic link, by any chance?  If it
is, try the -follow option.  For details, info find.
Igor

On Fri, 31 Jan 2003, Carlo Florendo wrote:

 find . -name 1000.*

 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, January 31, 2003 5:57 PM
 Subject: Problems with find


 Hi folks,

 I trie to search file with find an didn't find all the file which should be
 found

 I search for all file starting with 1000 an the file 1000.zip in the
 diretory 1000 is not found
 $ find . -name 1000\*
 ./1000.zip
 ./1000

 but when I ls the directory 1000 the file is listed
 $ ls 1000
 1000.zip

 As you can see I use the find installed in /usr/bin
 $ which find
 /usr/bin/find
 $ type find
 find is hashed (/usr/bin/find)


 what is wrong? Is it a bug or my fault?

 Thanks for any help and hint

 Franz

-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




RE: Problems with find

2003-01-31 Thread Randall R Schulz
Ian,

At 06:49 2003-01-31, Ian R. Chesal wrote:

Your syntax is incorrect. Try:


No. Both Franz's and your syntaxes are acceptable. A backslash is 
equally useful for protecting the shell glob character '*' as is 
surrounding the argument (or just the asterisk) in single or double quotes.

Franz's problem was that when he use ls to show the files, he 
_didn't_ use an unquoted star (he didn't use a star at all), so ls 
showed only the file whose name appeared literally in its invocation.

Me may also have been confused about where the problem lay, think it 
was in find rather than ls (when in fact it was just plain old 
cockpit error).

Randall Schulz


find . -name 1000*

I just tried in in /tmp on my cygwin installation and here's the output:

$ find . -name 1000* -o -name 1000.*
./1000
./1000/1000.zip
./1000.tar.gz

You can limit the find to just files or directories with the -type flag.
Do 'info find' to learn more. The way you had the expression written
each conditional was joined with an implicit -a (and) so that find would
only print if all three evaluated to true. You wanted a -o (or) between
each pattern but really you can accomplish what you want with a quoted
pattern, which IMHO is a more straight-forward way to look for what you
want.

Ian

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf
Of [EMAIL PROTECTED]
Sent: January 31, 2003 3:57 AM
To: [EMAIL PROTECTED]
Subject: Problems with find


Hi folks,

I trie to search file with find an didn't find all the file which should
be found

I search for all file starting with 1000 an the file 1000.zip in the
diretory 1000 is not found $ find . -name 1000\* ./1000.zip ./1000

but when I ls the directory 1000 the file is listed
$ ls 1000
1000.zip

As you can see I use the find installed in /usr/bin
$ which find
/usr/bin/find
$ type find
find is hashed (/usr/bin/find)


what is wrong? Is it a bug or my fault?

Thanks for any help and hint

Franz



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Re: Problems with find -exec somecommand | tosomeother command

2002-10-04 Thread Randall R Schulz

Sheryl,

[ Non-Cygwin-specific ]


Here's how I'd do this:

 find . -name *.frm -exec wc -l {} \;


The result looks something like this (I changed the .frm suffix to 
.java for the purpose of finding some files on my system):

1114 ./DeferredUpdateKB.java
 295 ./Definitor.java
  93 ./FlatFormatStrategy.java
  59 ./FormatStrategy.java
 139 ./FormattingCursor.java
 111 ./FormulaPrinter.java
  77 ./FormulaRenderer.java
1379 ./KBContext.java
4503 ./KIF3.java
 191 ./KIF3Constants.java
 544 ./KIF3Generator.java
 293 ./KIF3InfixPrinter.java
2431 ./KIF3TokenManager.java
  91 ./LexicalGenerator.java
1912 ./NameTable.java
 298 ./ParseActions.java
 192 ./ParseException.java
 913 ./PrefixPrinter.java
 175 ./PrettyFormatStrategy.java
 401 ./SimpleCharStream.java
1848 ./TauTest.java
  81 ./Token.java
 133 ./TokenMgrError.java


To let you know why what you tried wasn't working, you must realize that 
the pipe split the find command (and the cat subprocesses it spawns) 
from the tail command. The -exec option of find is pretty much just a 
means of invoking the Unix exec(2) system call. It is not like the 
system(3) library routine, which uses a shell to interpret the command 
string.

If you want pipelines, glob expansion or other shell features in the 
commands executed by the -exec option, you should use sh -c or bash 
-c. Note, too, that in that case the command argument to the -c option 
must be a single argument. This can get tricky as far as quoting and all. 
Fortunately, the {} marker into which the current find target is 
substituted does work when embedded within a larger string--it need not be 
an total, isolated find argument.

Good luck.

Randall Schulz
Mountain View, CA USA


At 11:39 2002-10-04, Sheryl McKeown wrote:
Hello,

I'm attempting to find the number of lines in each
file of a source directory.

Using bash, I'm using the following command:

find . -name *.frm -exec cat -n {} | tail -n1 \;
but it returns the error

cfind: missing argument to `-exec'
tail: ;: No such file or directory

I've tried various quoting schemes but I can't seem to
get it to work.

I am running XP Prof SP1.

Any help is appreciated.

-Sheryl


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Re: Problems with find -exec somecommand | tosomeother command

2002-10-04 Thread Sheryl McKeown

Hi Randall,

Thanks for the explanation and the working version.  

Best,
Sheryl

--- Randall R Schulz [EMAIL PROTECTED] wrote:
 Sheryl,
 
 [ Non-Cygwin-specific ]
 
 
 Here's how I'd do this:
 
  find . -name *.frm -exec wc -l {} ;
 
 
 The result looks something like this (I changed the
 .frm suffix to 
 .java for the purpose of finding some files on my
 system):
 
 1114 ./DeferredUpdateKB.java
  295 ./Definitor.java
   93 ./FlatFormatStrategy.java
   59 ./FormatStrategy.java
  139 ./FormattingCursor.java
  111 ./FormulaPrinter.java
   77 ./FormulaRenderer.java
 1379 ./KBContext.java
 4503 ./KIF3.java
  191 ./KIF3Constants.java
  544 ./KIF3Generator.java
  293 ./KIF3InfixPrinter.java
 2431 ./KIF3TokenManager.java
   91 ./LexicalGenerator.java
 1912 ./NameTable.java
  298 ./ParseActions.java
  192 ./ParseException.java
  913 ./PrefixPrinter.java
  175 ./PrettyFormatStrategy.java
  401 ./SimpleCharStream.java
 1848 ./TauTest.java
   81 ./Token.java
  133 ./TokenMgrError.java
 
 
 To let you know why what you tried wasn't working,
 you must realize that 
 the pipe split the find command (and the cat
 subprocesses it spawns) 
 from the tail command. The -exec option of find
 is pretty much just a 
 means of invoking the Unix exec(2) system call. It
 is not like the 
 system(3) library routine, which uses a shell to
 interpret the command 
 string.
 
 If you want pipelines, glob expansion or other shell
 features in the 
 commands executed by the -exec option, you should
 use sh -c or bash 
 -c. Note, too, that in that case the command
 argument to the -c option 
 must be a single argument. This can get tricky as
 far as quoting and all. 
 Fortunately, the {} marker into which the current
 find target is 
 substituted does work when embedded within a larger
 string--it need not be 
 an total, isolated find argument.
 
 Good luck.
 
 Randall Schulz
 Mountain View, CA USA
 
 
 At 11:39 2002-10-04, Sheryl McKeown wrote:
 Hello,
 
 I'm attempting to find the number of lines in each
 file of a source directory.
 
 Using bash, I'm using the following command:
 
 find . -name *.frm -exec cat -n {} | tail -n1 ;
 but it returns the error
 
 cfind: missing argument to `-exec'
 tail: ;: No such file or directory
 
 I've tried various quoting schemes but I can't seem
 to
 get it to work.
 
 I am running XP Prof SP1.
 
 Any help is appreciated.
 
 -Sheryl
 
 
 --
 Unsubscribe info: 
 http://cygwin.com/ml/#unsubscribe-simple
 Bug reporting: http://cygwin.com/bugs.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/
 


__
Do you Yahoo!?
New DSL Internet Access from SBC  Yahoo!
http://sbc.yahoo.com

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/