aditya1977 has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a program that will parse a log file and write data to a MySQL database based on the content of the log file.
The script will run via cron and I want to make sure I skip lines that have been parsed before.
One idea I had was to base 64 encode the line and make this a unique key in the database. Then the next time the script runs, if there is a matching key, skip the line.
What I don't like about this is that the encoded line is quite a long string, which would make viewing the database difficult to read. Is there a way to encode a long string to a relatively short string string?
Or perhaps there is a better way to do this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trying to identify unique lines in a log file
by choroba (Cardinal) on Mar 05, 2015 at 10:39 UTC | |
by aditya1977 (Novice) on Mar 05, 2015 at 10:57 UTC | |
|
Re: Trying to identify unique lines in a log file
by Theodore (Hermit) on Mar 05, 2015 at 10:37 UTC | |
|
Re: Trying to identify unique lines in a log file
by GotToBTru (Prior) on Mar 05, 2015 at 19:45 UTC |