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
}
|