#!/usr/bin/perl -s our($q,$lc); use strict; my $patt=shift or die; my $file=shift or die; open(F,"-|","grep -P '($patt)|count =>|trans =>|\}|DIC\\d = \{|use utf8' $file"); if($lc){open(G,">","/tmp/_pos$$")} #print "use utf8;\n\$DIC1 = {\n"; while(){ if($lc){ print G $_; } else { print $_; } last if /DIC\d/; } $/="\n},"; while(){ next unless /\n"/; s/"($patt)/"/g unless $q; if($lc){ print G $_; } else { print $_; } } if($lc){ print G "};\n"; close G; system("nat-ptd lowercase /tmp/_pos$$"); } else { print "};\n"; }