new-words
view grep-sentences.pl @ 17:35eeaf2620ce
minifix
author | Igor Chubin <igor@chub.in> |
---|---|
date | Sun Apr 04 20:11:22 2010 +0300 (2010-04-04) |
parents | d1851ee29a1a |
children | 416394a87d9f |
line source
1 #!/usr/bin/perl
4 $regexp=$ARGV[0];
5 $page=$ARGV[1];
6 #if (open(PAGE, "lynx -dump '$page'|")) {
7 if (open(PAGE, "$page")) {
8 local $/;
9 $text=<PAGE>;
10 $text =~ s@http://[a-zA-Z&_.:/0-9%?=,\#+()\[\]~-]*@@g;
11 $text =~ s@\n@@g;
12 $text =~ s@(Mr|Mrs)\.@\1POINT@g;
13 @sentences=split /\./, $text;
14 for (@sentences) {
15 s@(Mr|Mrs)POINT@\1.@g;
16 s/^\s*//;
17 s/\s*$//;
18 s/\[[0-9]+\]//g;
19 s/\s+/ /g;
20 print "$_.\n\n" if /\b$regexp\b/;
21 }
22 }