Re: Regular Expressions from Bash Shell

2004-09-02 Thread Brian Dessent
Christopher Faylor wrote:

 I don't think either of those meets the letter of the original request.
 
 If you only want the files in the current directory then something like:
 
 ls -d *.f | grep -v '^_' | xargs grep EXPRESSION
 
 should work better.
 
 Or if you use zsh you can just do:
 
 grep EXPRESSION *.f~_*

or:

find . -type f -name \*.f -maxdepth 1 \! -name \*_\* |xargs grep EXPR

--
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: Regular Expressions from Bash Shell

2004-09-02 Thread Igor Pechtchanski
Well, since CGF himself didn't deem this too off-topic... :-)

On Wed, 1 Sep 2004, Christopher Faylor wrote:

 On Wed, Sep 01, 2004 at 06:07:15PM -0400, Buchbinder, Barry (NIH/NIAID) wrote:
 At Wednesday, September 01, 2004 5:17 PM, Igor Pechtchanski wrote:
  On Wed, 1 Sep 2004, Siegfried Heintze wrote:
 
  I want to use grep on all the FORTRAN source code files in the
  current directory whose file names do not contain a _ character.
  How do I do this?
 
  I'm using the extension of .f to designate FORTRAN.
 
  Disclaimer: this is not a shell programming support forum, and the
  above post is off-topic for this list, since it asks a general shell
  question not related to Cygwin.
 
  But, since I'm sending this e-mail anyway (and I hope this in no way
  encourages similar future posts):
 
  find . -name \*_\* -o -name \*.f -print | xargs grep EXPRESSION
 
 I think a ! was forgotten.

Nope.  Try the above -- only the names *without* underscores will be
*printed*, since \*_\* will match them first, and wisk them away from the
second match expression.

 find . \( ! -name \*_\* \) -o -name \*.f -print | xargs grep EXPRESSION
 
 The parentheses may not be needed -- you can try it both ways.

The above has a bug -- it should have a -a instead of a -o.  Once
that's fixed, that would be YA way of doing it.  The parentheses aren't
neded.  BTW, this suffers from the same problem as my original suggestion
above, though -- see below.

 I don't think either of those meets the letter of the original request.

True.

 If you only want the files in the current directory then something like:

 ls -d *.f | grep -v '^_' | xargs grep EXPRESSION

 should work better.

 Or if you use zsh you can just do:

 grep EXPRESSION *.f~_*

 cgf

Or you could add -mindepth 1 -maxdepth 1 to the find command above,
which would make it do exactly what the user wanted.
Igor
P.S. Should I add TMTOWTDI to the OLOCA? ;-)
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski, Ph.D.
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing.  -- Dr. Jubal Harshaw

--
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: Regular Expressions from Bash Shell

2004-09-02 Thread Christopher Faylor
On Thu, Sep 02, 2004 at 12:20:13PM -0400, Igor Pechtchanski wrote:
P.S. Should I add TMTOWTDI to the OLOCA? ;-)

Sure.

cgf

--
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/



Regular Expressions from Bash Shell

2004-09-01 Thread Siegfried Heintze
I want to use grep on all the FORTRAN source code files in the current
directory whose file names do not contain a _ character. How do I do this?

I'm using the extension of .f to designate FORTRAN. 
Thank you,
   Siegfried


--
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: Regular Expressions from Bash Shell

2004-09-01 Thread Igor Pechtchanski
On Wed, 1 Sep 2004, Siegfried Heintze wrote:

 I want to use grep on all the FORTRAN source code files in the current
 directory whose file names do not contain a _ character. How do I do this?

 I'm using the extension of .f to designate FORTRAN.

Disclaimer: this is not a shell programming support forum, and the above
post is off-topic for this list, since it asks a general shell question
not related to Cygwin.

But, since I'm sending this e-mail anyway (and I hope this in no way
encourages similar future posts):

find . -name \*_\* -o -name \*.f -print | xargs grep EXPRESSION

Again, the above is *not* Cygwin-specific.
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski, Ph.D.
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing.  -- Dr. Jubal Harshaw

--
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: Regular Expressions from Bash Shell

2004-09-01 Thread Buchbinder, Barry (NIH/NIAID)
At Wednesday, September 01, 2004 5:17 PM, Igor Pechtchanski wrote:
 On Wed, 1 Sep 2004, Siegfried Heintze wrote:
 
 I want to use grep on all the FORTRAN source code files in the
 current directory whose file names do not contain a _ character.
 How do I do this? 
 
 I'm using the extension of .f to designate FORTRAN.
 
 Disclaimer: this is not a shell programming support forum, and the
 above post is off-topic for this list, since it asks a general shell
 question not related to Cygwin.
 
 But, since I'm sending this e-mail anyway (and I hope this in no way
 encourages similar future posts):
 
 find . -name \*_\* -o -name \*.f -print | xargs grep EXPRESSION

I think a ! was forgotten.

find . \( ! -name \*_\* \) -o -name \*.f -print | xargs grep EXPRESSION

The parentheses may not be needed -- you can try it both ways.

 Again, the above is *not* Cygwin-specific.
   Igor

--
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: Regular Expressions from Bash Shell

2004-09-01 Thread Yitzchak Scott-Thoennes
On Wed, Sep 01, 2004 at 03:09:21PM -0600, Siegfried Heintze wrote:
 I want to use grep on all the FORTRAN source code files in the current
 directory whose file names do not contain a _ character. How do I do this?
 
 I'm using the extension of .f to designate FORTRAN. 

   find *.f ! -name '*_*'|xargs grep

is how I would do it, but there's probably a better way.  (Assuming
you have no subdirectories ending with .f)

--
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: Regular Expressions from Bash Shell

2004-09-01 Thread Christopher Faylor
On Wed, Sep 01, 2004 at 06:07:15PM -0400, Buchbinder, Barry (NIH/NIAID) wrote:
At Wednesday, September 01, 2004 5:17 PM, Igor Pechtchanski wrote:
 On Wed, 1 Sep 2004, Siegfried Heintze wrote:
 
 I want to use grep on all the FORTRAN source code files in the
 current directory whose file names do not contain a _ character.
 How do I do this? 
 
 I'm using the extension of .f to designate FORTRAN.
 
 Disclaimer: this is not a shell programming support forum, and the
 above post is off-topic for this list, since it asks a general shell
 question not related to Cygwin.
 
 But, since I'm sending this e-mail anyway (and I hope this in no way
 encourages similar future posts):
 
 find . -name \*_\* -o -name \*.f -print | xargs grep EXPRESSION

I think a ! was forgotten.

find . \( ! -name \*_\* \) -o -name \*.f -print | xargs grep EXPRESSION

The parentheses may not be needed -- you can try it both ways.

I don't think either of those meets the letter of the original request.

If you only want the files in the current directory then something like:

ls -d *.f | grep -v '^_' | xargs grep EXPRESSION

should work better.

Or if you use zsh you can just do:

grep EXPRESSION *.f~_*

cgf

--
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/