Afficher un message
Vieux 26/03/2008, 14h12   #3
Hermann Peifer
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Shell/Awk processing question

On Mar 26, 3:16am, sf94...@gmail.com 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"). I'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 = strftime("%F %H:%M",systime()-60) }

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

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

print >> file_name
}
  Réponse avec citation
 
Page generated in 0,04789 seconds with 9 queries