in reply to Optimise the script
As has already been said by others, if all you're trying to do is match a single day, then I would create a regex that matched those preconverted days. Most likely you'd need two regex's, one to match the start of the day and one to match the end. If this test passed, then you could do the more costly conversion of the date to determine whether or not it actually matched the proper date.
However, the best thing you can do to increase your runtime is to rely on the fact that this data is probably ordered by date/time. Once you find your given date and leave it, you no longer need to process the file. Even better would be to create an index file of positions where each PST date starts. You could regularly update your index by continuing where it last left off, and then this script would be able to run immediately.
- Miller
PS, Also note that your Unixdate conversion of your dates in the loop doesn't seem to be working right. The format you specified isn't actually the format in the file.
|
|---|