new-words
view grep-sentences.pl @ 8:0ff259b8b6a3
v0.1: INSTALL.sh + minifixes
author | Igor Chubin <igor@chub.in> |
---|---|
date | Wed Mar 31 18:59:02 2010 +0300 (2010-03-31) |
parents | 9345cc05fdd1 |
children | c6efd17741aa |
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 @sentences=split /\./, $text;
13 for (@sentences) {
14 s/^\s*//;
15 s/\s*$//;
16 s/\[[0-9]+\]//g;
17 s/\s+/ /g;
18 print "$_.\n\n" if /\b$regexp\b/;
19 }
20 }