new-words

view grep-sentences.pl @ 13:975b549364f2

minifix
author Igor Chubin <igor@chub.in>
date Sat Apr 03 15:11:12 2010 +0300 (2010-04-03)
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 }