Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Re: Poss OT? Cr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 2137 of 2341
Post > Topic >>

Re: Poss OT? Creating test data for gawk prog

by Ed Morton <morton@[EMAIL PROTECTED] > Jan 22, 2008 at 03:14 PM

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.
 




 2 Posts in Topic:
Poss OT? Creating test data for gawk prog
freecycle <f.cycle@[EM  2008-01-22 09:17:53 
Re: Poss OT? Creating test data for gawk prog
Ed Morton <morton@[EMA  2008-01-22 15:14:05 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Aug 27 17:56:17 CDT 2008.