RE: How to reinvent grep with perl? (OT: Cygwin grep)

2004-10-10 Thread Bakken, Luke
> > Voila. That's most likely your problem - a mismatch between 
> line endings
> > and Cygwin mount point type.
> 
> And in case you hadn't seen them before... there are at least a few
> sets of unix tools for dos/windows.  Cygwin maybe the best known but
> I've used Uwin myself for sometime  and never had a problem with its
> grep.
> 
> http://www.research.att.com/sw/tools/uwin/

And another suggestion:

http://gnuwin32.sourceforge.net

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: How to reinvent grep with perl? (OT: Cygwin grep)

2004-10-10 Thread Harry Putnam
"Bakken, Luke" <[EMAIL PROTECTED]> writes:

> Voila. That's most likely your problem - a mismatch between line endings
> and Cygwin mount point type.

And in case you hadn't seen them before... there are at least a few
sets of unix tools for dos/windows.  Cygwin maybe the best known but
I've used Uwin myself for sometime  and never had a problem with its
grep.

http://www.research.att.com/sw/tools/uwin/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: How to reinvent grep with perl?

2004-10-09 Thread Harry Putnam
"Siegfried Heintze" <[EMAIL PROTECTED]> writes:

> This, works, but it sure is ugly. Is there not an easier way to do this with
> perl?
>
> perl -e'@ARGV = ("-") unless @ARGV; while(@ARGV){ $ARGV= shift @ARGV;
> if(!open(ARGV, $ARGV)){ warn "Cannot open $ARGV: $!\n"; next;} while
> (){ print "$ARGV:$.:$_\n" if/^ *END *$/; }}' *.f

Doesn't something simple like:

 perl -n -e 'print "$ARGV\n$. $_" if /PATTERN/' *.f
work for you.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: How to reinvent grep with perl?

2004-10-09 Thread Siegfried Heintze
Perl works better than grep because the grep statement you give below does
not find any instances of the pattern and perl finds quite a few. I'm using
Cygwin on Win2003Server. Since there is something obviously wrong with my
cygwin implementation of grep, how do I get the file names with perl?

This, works, but it sure is ugly. Is there not an easier way to do this with
perl?

perl -e'@ARGV = ("-") unless @ARGV; while(@ARGV){ $ARGV= shift @ARGV;
if(!open(ARGV, $ARGV)){ warn "Cannot open $ARGV: $!\n"; next;} while
(){ print "$ARGV:$.:$_\n" if/^ *END *$/; }}' *.f

Thanks,
Siegfried

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Harry Putnam
Sent: Saturday, October 09, 2004 4:33 PM
To: [EMAIL PROTECTED]
Subject: Re: How to reinvent grep with perl?

"Siegfried Heintze" <[EMAIL PROTECTED]> writes:

> My man pages and info pages are not working well and I cannot figure out
how
> to make grep search for a certain pattern. I even tried egrep and fgrep.
So
> how do I reinvent grep with perl? Here is my attempt:
>
>  
>
> perl -n -e 'print "$. $_" if /^ *END *$/' *.f

grep -n '^ *END *$' *.f


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How to reinvent grep with perl?

2004-10-09 Thread Harry Putnam
"Siegfried Heintze" <[EMAIL PROTECTED]> writes:

> This works better than grep, except for the fact it does not print the file
> name. How can I make perl print the file file name?

How is it better than grep?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: How to reinvent grep with perl?

2004-10-09 Thread Harry Putnam
"Siegfried Heintze" <[EMAIL PROTECTED]> writes:

> My man pages and info pages are not working well and I cannot figure out how
> to make grep search for a certain pattern. I even tried egrep and fgrep. So
> how do I reinvent grep with perl? Here is my attempt:
>
>  
>
> perl -n -e 'print "$. $_" if /^ *END *$/' *.f

grep -n '^ *END *$' *.f


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: How to reinvent grep with perl?

2004-10-09 Thread Andrew Gaffney
Siegfried Heintze wrote:
Andrew,
  Thanks. When I hit "n" to go to the next page, it says "No previous
regular expression (press RETURN)". So I can only display the first page. I
have it expanded to the full screen but I still cannot see the portion of
the display that tells me how to use extended regular expressions.
Apparently the basic regular expressions don't include "^" and "$".
If your 'man' uses 'less' like mine does, you hit Space to go to the next page 
and use the arrow keys to scroll one line at a time. I haven't used 'info' in a 
while, but I believe you can search those with 's'.

--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.
636-357-1548
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: How to reinvent grep with perl?

2004-10-09 Thread Andrew Gaffney
Siegfried Heintze wrote:
My man pages and info pages are not working well and I cannot figure out how
to make grep search for a certain pattern. I even tried egrep and fgrep. So
how do I reinvent grep with perl? Here is my attempt:
There's no need. When you do 'man whatever', you can hit '/', type a search 
term, and hit enter. To search that same term again, '/' then enter will do. 
This works on my Gentoo Linux box.

--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.
636-357-1548
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]