new-words
diff grep-sentences.pl @ 38:adbc809d3924
Transition to Python started
new-words-py.sh is a wrapper around
new-words.py version which is not finished yet.
new-words-py.sh is a wrapper around
new-words.py version which is not finished yet.
author | Igor Chubin <igor@chub.in> |
---|---|
date | Sat Jan 22 23:42:31 2011 +0100 (2011-01-22) |
parents | c631833fa2be |
children | 3a61988109a8 |
line diff
1.1 --- a/grep-sentences.pl Mon Jun 21 19:46:58 2010 +0300 1.2 +++ b/grep-sentences.pl Sat Jan 22 23:42:31 2011 +0100 1.3 @@ -9,6 +9,8 @@ 1.4 $regexp=decode("utf8",$regexp); 1.5 1.6 $page=$ARGV[1]; 1.7 +$number_of_printed = 0; 1.8 +$number_of_printed_max = 10; 1.9 #if (open(PAGE, "lynx -dump '$page'|")) { 1.10 if (open(PAGE, "$page")) { 1.11 binmode PAGE,":utf8"; 1.12 @@ -28,6 +30,9 @@ 1.13 s/\s*$//; 1.14 s/\[[0-9]+\]//g; 1.15 s/\s+/ /g; 1.16 - print "$_.\n\n" if /\b$regexp\b/; 1.17 + if (/\b$regexp\b/ and $number_of_printed < $number_of_printed_max ) { 1.18 + print "$_.\n\n"; 1.19 + $number_of_printed++; 1.20 + } 1.21 } 1.22 }