#!/usr/bin/perl -w # vim: set sw=4 ts=4 si et: # Copyright: GPL, Author: Guido Socher # $Revision: $, last changed: $Date: $ # use strict; use vars qw($opt_h); use Getopt::Std; sub help(); # getopts("a:h")||die "ERROR: No such option. -h for help.\n"; help() if ($opt_h); my ($auth,$trans,$title,$n,$d); for (@ARGV){ s/\///g; die "ERROR: Not a directory: $_\n" if (! -d "$_"); die "ERROR: Not a MonthYear directory: $_\n" unless (/^\w+\d{4}/); opendir(DIR,"$_")||die; print "#---------\nmonth:$_ ++ $_\n"; $d=$_; for my $f (sort readdir DIR){ next unless($f=~/article(\d+).shtml/); $n=$1; open(FF,"$d/$f")||die; $auth=""; $trans=""; $title=""; while(){ if (/=LF=AUTHOR: (.+)/){ $auth=$1; } if (/=LF=TITLE_: (.+)/){ $title=$1; } if (/=LF=TRANSTO=de: (.+)/){ $trans=$1; } } close FF; $auth=~s/\s+/ /g; $title=~s/\s+/ /g; $trans=~s/\s+/ /g; $trans=$auth if (! $trans); # $trans=~s/\Ä/Ä/g; $trans=~s/\Ö/Ö/g; $trans=~s/\Ü/Ü/g; $trans=~s/\ä/ä/g; $trans=~s/\ö/ö/g; $trans=~s/\ü/ü/g; $trans=~s/\ß/ß/g; # # 294 ++ x ++ IDS - Intrusion Detection System, part II ++ X@x ++ Jürgen Pohl print "$n ++ x ++ $title ++ X@x ++ $trans\n"; } print "#---end $d\n"; } # sub help(){ print "generate a skeleton with some entries for lf_deutsch_def.txt USAGE: lf_deutsch_def_generate DirOfMonth1 DirOfMonth2 ....\n"; exit; } __END__