[Xitami] Log question

Brian {Hamilton Kelly} xitami@lists.xitami.org
Tue, 15 Oct 2002 00:48:47 +0100


[I'm still over a week behind in catching up on three mailing lists, so
forgive me if someone has already posted a correction: a cursory look
through the titles of unread mails didn't seem to show any such, however]

In message <1912056257842.20021003144033@rci.rutgers.edu>
   Paul Reid writes:
> > a way to combine monthly access logs so that my log analyzer can
> > process more than one month at a time?
> 
> In DOS/Win:
> 
> copy ac020201.log + ac020301.log + ac020301.log big.log

Yes.  [I'm not too sure that DOS permits spaces around the plus-signs,
however; I've certainly never used them.]

> or -
> 
> echo ac02????.log >> big.log

Errm, the above will append the string of characters "ac02????.log" to
the file big.log (creating the latter if it doesn't already exist).

I suspect that you might have wanted to suggest
> type ac02????.log >> big.log
which would output each log file to stdout, which is redirected to append
to big.log.

However, that is not possible: remember that DOS/Windoze does all file
globbing IN the applications, and that the TYPE command is not written to
perform wildcard expansion.

However, all is not lost: DOS possesses a FOR command, so the original
poster could try:
> for %f in (ac02????.log) do type %f >> big.log
which will concatenate all the files into big.log.  However, there is no
guarantee that they will be in any particular order: DOS will get them in
whatever order they have been fitted into empty slots in the directory
structure.  So it might be necessary instead to write:
> for %f in (ac020101 ac020201 ac020301) do type %f.log >> big.log
if the order is important to the analysis.

> In Unix, replace echo with cat?

Errm, yes.  The files will appear in the "correct" order.

-- 
Brian {Hamilton Kelly}                                          bhk@dsl.co.uk
    "We have gone from a world of concentrated knowledge and wisdom to one of
    distributed ignorance.  And we know and understand less while being incr-
    easingly capable."              Prof. Peter Cochrane, formerly of BT Labs