Jacob
Jacob

Reputation: 1

Parsing a log file help

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!

Upvotes: 0

Views: 132

Answers (1)

NorthGuard
NorthGuard

Reputation: 963

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.

Upvotes: 3

Related Questions