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.
精彩评论