On 1/22/2008 11:17 AM, freecycle wrote:
> Hope I am OK to ask this in this group.
> I've coded an gawk script to read in any no of log files
> containing a count of the number of searches per 30
> min performed on an application. To test it I've seeded
> a rand and created log files with a DateTime field and
> a count figure covering a month. The script works OK
> but the resultant Excel chart looks nothing like real life.
> How would I create log files where the count is zero
> till about 7am, rises to a peak at 11am, back down over
> dinner, another peak at 3pm, and dies down till nothing
> after 6pm?
> I'd be grateful for any suggestions,
> |FC
As posted, it does sound OT since you're asking for an algorithm to
produce an
input file that your awk script will run on, but if we consider this
instead as
a request for help writing an awk script that'll produce that file, maybe
it's
not as OT but you might still get better help with an algorithm in some
other NG.
I think you could do what you want using GNU awk (gawk) and it's time
functions.
You could write loops like:
secs=strftime(<some midnight>)
for (i=secs;i<=<some max>;i+=<some interval>) {
print mktime(<some format>,i)
}
so it'd print some number of timestamps up to a max. The smaller the max
and
larger the interval, the fewer time stamps you'll get.
Just repeat for each interval you care about.
Ed.


|