Jump to content

[SOLVED] Remove timestamps from an array


soadlink

Recommended Posts

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  8) Thanks for the help!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.