Talk About Network



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: Shell/Awk p...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 5 Topic 2204 of 2236
Post > Topic >>

Re: Shell/Awk processing question

by Hermann Peifer <peifer@[EMAIL PROTECTED] > Mar 26, 2008 at 05:12 AM

On Mar 26, 3:16=A0am, sf94...@[EMAIL PROTECTED]
 wrote:
>
> Since the retrieval process isn't very refined, I'm stuck with log
> output that spans several minutes, but I'm only interested in the
> output from the past minute (date +%H:%M --date "1 minute ago"). =A0I've
> tried to write a small awk process that would go through the log file
> every 5 minutes and capture the output from the past minute and write
> it out to individual log files locally.
>

This might be a start for your awk script:

BEGIN { past_minute =3D strftime("%F %H:%M",systime()-60) }

/^=3D=3D>/ { file_name =3D $2 ; gsub("/","_",file_name) }

substr($0,1,16) =3D=3D past_minute {
      # Some logic if you want to print
      # or ignore the following lines
      # ...

      print >> file_name
}




 5 Posts in Topic:
Shell/Awk processing question
sf94061@[EMAIL PROTECTED]  2008-03-25 19:16:16 
Re: Shell/Awk processing question
Bill Marcum <marcumbil  2008-03-26 03:51:42 
Re: Shell/Awk processing question
Hermann Peifer <peifer  2008-03-26 05:12:19 
Re: Shell/Awk processing question
Maxwell Lol <nospam@[E  2008-03-26 11:36:55 
Re: Shell/Awk processing question
Hermann Peifer <peifer  2008-03-26 05:16:48 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sat May 17 2:30:33 CDT 2008.