soadlink Posted February 14, 2007 Share Posted February 14, 2007 Hello, I have a script that does some logging to a .rtf file, and in the logs it adds timestamps and creates a new line "\n". So I end up with a bunch of lines like so: word1 (Sun Feb 11th, 2007 04:45 am) word2 (Sun Feb 11th, 2007 04:46 am) word3 (Sun Feb 11th, 2007 04:47 am) word4 (Sun Feb 11th, 2007 04:48 am) I realized now that for what I'm doing this wasn't a very good idea to log the timestamps because they aren't important, and need to remove the timestamps. There are hundreds of lines per log, and many logs, so editing it manually would take a long time. The days, dates, times, etc.. are all different and are not in any order like in my example. I am looking for a way to load the log file as an array, and remove all the timestamps, and output the result as a new array. So for my example the new array would be: word1 word2 word3 word4 If there is a way to remove the everything in between the (), that would work too because none of the 'words' will have () in them, so there would be no conflicts. Or if you guys know a quicker way than using a php script let me know Thanks for the help! Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted February 14, 2007 Share Posted February 14, 2007 Well if you truly don't care about having a timestamp for anyhting in your db table why not just use phpmyadmin to go into your table and delete the row that stores the timestamp information? Quote Link to comment Share on other sites More sharing options...
soadlink Posted February 14, 2007 Author Share Posted February 14, 2007 Because the information is not stored in a database, its stored in an .rtf file. Quote Link to comment Share on other sites More sharing options...
effigy Posted February 14, 2007 Share Posted February 14, 2007 $line = preg_replace('/\s*\(.+?\)/', '', $line); Quote Link to comment Share on other sites More sharing options...
soadlink Posted February 14, 2007 Author Share Posted February 14, 2007 $line = preg_replace('/\s*\(.+?\)/', '', $line); Perfect, thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.