#!/usr/bin/perl -ln BEGIN { ($OPT = " @ARGV ") =~ s/\s+-d\s+\w+//g; $IS_APPEND = $OPT =~ /\s-a\s/; @ARGV = ('-'); umask 077; open $R,"| /usr/bin/aspell $OPT -d russian --ignore-accents >/tmp/aspell_ru.$$"; open $E,"| /usr/bin/aspell $OPT -d english >/tmp/aspell_en.$$"; } if ($IS_APPEND) { if (/^\*/) { print { /[\xA3\xB3\xC0-\xFF]/ ? $R : $E } $_; } else { print $R $_; print $E $_; } } else { print { /[\xA3\xB3\xC0-\xFF]/ ? $R : $E } $_ for split /[^\@0-9_a-zA-Z\xA3\xB3\xC0-\xFF]+/; } END { close $R; close $E; system("cat /tmp/aspell_{en,ru}.$$ ; rm /tmp/aspell_{en,ru}.$$"); }