On Sat, 3 Mar 2001, Wallace Mills wrote:
> Hi all,
> I hope you can given me some pointers/help as to how to use the
> mailstats program inconjunction with analog. I am using
> maillog2commonlog with postfix as the mail program.
> Reading the docs, it states to pipe the actual mail logs through
> maillog2commonlog like so: maillog2commonlog < maillog. My
> question is where does the output of this end up, does it
> generate another file or ???? and how do I send this output (if
> there is one) to analog.??
> I'm sorry if this seems to be a very simple question but I can
> not find any information re this form of the usage of pipes
> anywhere including my own reference books. Even though I have
> been using Linux for a few months now I still have a lot to
> learn.
Specific question :
-----------------
I haven't used maillog2commonlog, but I assume it outputs to standard
output (stdout to its friends). You can either redirect stdout to a file
like this:
maillog2commonlog < maillog > outfile
and then get analog to read that file:
analog outfile
Or you can use a pipe. A pipe just send the standard output of one program
directly into the standard input of a second program, without having to
write the file to the disk in between. This command would look like this:
maillog2commonlog < maillog | analog -
(The | represents the pipe. The - tells analog to read standard input
instead of a file from disk).
General discourse :)
-----------------
Pipes are well worth understanding. Once you're used to them, you can write
a one-line command by stringing several pipes together. For example, which
lines have been deleted between file1 and file2?
diff file1 file2 | grep "^<" | less
This may look scary at first, but I've managed to do it all at once instead
of in three stages as you might have to on a lesser operating system.
I would say that pipes -- together with the fact that all programs read and
write plain text files not proprietary formats so that they can all talk to
each other -- are one of the things that makes Unix really powerful.
--
Stephen Turner http://www.statslab.cam.ac.uk/~sret1/
Statistical Laboratory, Wilberforce Road, Cambridge, CB3 0WB, England
"Your account can only be used for a single internet session at any one
time and for no more than 24 hours in any one day." (NTL terms of use)
------------------------------------------------------------------------
This is the analog-help mailing list. To unsubscribe from this
mailing list, send mail to [EMAIL PROTECTED]
with "unsubscribe" in the main BODY OF THE MESSAGE.
List archived at http://www.mail-archive.com/[email protected]/
------------------------------------------------------------------------