[Cialug] PerlRE

Dave Crouse crouse at usalug.net
Tue Sep 4 14:21:03 CDT 2007


That awk line won't work if "We go to the XXXX" is in the middle of a
line and not the beginning.

perl -e 'while(<>) { if ( $_ =~ /(We go to the \w+)($|\W|\.)/ ) {
print $1 . "\n";} }' FILENAMETOSEARCH

from a command line would work......or you could use it in a script as
Chris said above.





On 9/4/07, Major Stubble <major.stubble at gmail.com> wrote:
> 'awk' would work the best:
>
> awk '/We go to the / {print $5}' filename
>
> -Nick
>
> On Sep 2, 2007, at 2:40 PM, Eric Junker wrote:
>
> > Todd Walton wrote:
> >> But how do I yank and return just "We go to the " out of it?
> >
> > Depending on how exact you need your output, grep might be sufficient.
> >
> > grep "We go to the" file.txt
> >
> > Eric
> > _______________________________________________
> > Cialug mailing list
> > Cialug at cialug.org
> > http://cialug.org/mailman/listinfo/cialug
>
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>


More information about the Cialug mailing list