开发者

Parsing a log file help

开发者 https://www.devze.com 2023-03-13 17:39 出处:网络
I\'m trying to write a either bash or perl script which runs twice a day that copies the last entry in a log and takes only the numbers and copies and replaces the value in a .dat file with those numb

I'm trying to write a either bash or perl script which runs twice a day that copies the last entry in a log and takes only the numbers and copies and replaces the value in a .dat file with those numbers. The format in 开发者_开发技巧the log is:

(Event{id=275800).

Thanks in advance!


tail -n 1 logfile.log | sed 's/.*id=\([^)]\+\).*/\1/' > file.dat

would be the bash command for it, as for twice a day a cronjob would be the easiest I think.

0

精彩评论

暂无评论...
验证码 换一张
取 消