Rejo <subs(_at_)sisterray(_dot_)xs4all(_dot_)nl> writes:
I still have one question:
| formail -tz -xDate: -xFrom: -xSubject: >> $LOGDIR/bot
This puts all the information on new lines. Is there an easy way to have
to things, Date, From and Subject on a single line?
It is now
Wed, 26 May 1999 23:32:42 +0000
Rejo <rejo(_at_)sisterray(_dot_)xs4all(_dot_)nl>
send pgp keys
and i would like to get
Wed, 26 May 1999 23:32:42 +0000 Rejo
<rejo(_at_)sisterray(_dot_)xs4all(_dot_)nl> send pgp
keys
in my log. Any idea's?
You'll have to either post-process the formail output or just do it in
another program entirely. I would do the latter:
#!/usr/local/bin/perl
chomp($field = <>); # preload the header field buffer
while(<>) {
chomp;
if (s/^\s//) { # continued header field?
$field .= $_; # append it and goto the next line
redo
}
# Okay, we've hit a new header field. Deal with the one
# we buffered
if ($field =~ s/^Date:\s?//i) {
$date = $field;
} elsif ($field =~ s/^From:\s?//i) {
$from = $field;
} elsif ($field =~ s/^Subject:\s?//i) {
$subject = $field;
}
# Maybe the 'new header field' is really the of the header?
if ($_ eq "") {
last
}
# It's a real header field. Load it into the buffer.
$field = $_;
}
print "$date\t$from\t$subject\n";
Philip Guenther