
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tlug] grep sort of thing
- Date: Wed, 11 Jun 2003 00:10:52 -0700 (PDT)
- From: Jake Morrison <jake_morrison@example.com>
- Subject: Re: [tlug] grep sort of thing
Or with Perl....
#!/usr/bin/perl
my $re = shift;
while (<>) {
print $1, "\n" if /($re)/;
}
The $1 variable holds whatever the regular expression matched.
Jake
--- Brett Robson <b-robson@example.com> wrote:
>
> Hi all,
>
> There must be a simple way to do this but I can't work it out.
>
> I want to display strings from a text file(s) based on a reg exp,
> sort
> of like egrep but only displaying the matched string not the whole
> line
> from the file.
>
> Thanks
> Brett
>
>
>
> **********************************************************
> TLUG server is hosted by Open Source Development Lab Japan
> http://www.osdl.jp/
> **********************************************************
>
> ==========================================================
> To unsubscribe from this mailing list,
> please see instructions at <http://www.tlug.jp/list.html>
> ==========================================================
>
Home |
Main Index |
Thread Index