Mar-15-2022, 08:24 PM
So i have a text file with the following line structure: (In some cases the text file has thousands of rows)
3/8/22, 4:06 PM, String Value
3/8/22, 4:12 PM, String Value
3/8/22, 4:12 PM, String Value
3/8/22, 4:13 PM, String Value
3/8/22, 4:14 PM, String Value
3/8/22, 4:14 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:17 PM, String Value
3/8/22, 4:17 PM, String Value
I would be like to be able to run a script against this file to delete rows above a given date/time..
So in the above example, say my date/time was "3/8/22, 4:15 PM", so in that case, i would need to delete the following rows:
DELETE THESE
3/8/22, 4:06 PM, String Value
3/8/22, 4:12 PM, String Value
3/8/22, 4:12 PM, String Value
3/8/22, 4:13 PM, String Value
3/8/22, 4:14 PM, String Value
3/8/22, 4:14 PM, String Value
UPDATED FILE TO ONLY CONTAIN THESE
3/8/22, 4:15 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:17 PM, String Value
3/8/22, 4:17 PM, String Value
I have found a few example of using "seek" and found some examples using pointers to get the position, but those examples were very simple search for specific word/string and wasnt able to use my data to accomplish the same thing.
In my case i need to match the date and time to find that row, then delete everything above that row. And in the above case, which is possible, i need to make sure that it deletes above the first row found with that date/time combo..
3/8/22, 4:06 PM, String Value
3/8/22, 4:12 PM, String Value
3/8/22, 4:12 PM, String Value
3/8/22, 4:13 PM, String Value
3/8/22, 4:14 PM, String Value
3/8/22, 4:14 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:17 PM, String Value
3/8/22, 4:17 PM, String Value
I would be like to be able to run a script against this file to delete rows above a given date/time..
So in the above example, say my date/time was "3/8/22, 4:15 PM", so in that case, i would need to delete the following rows:
DELETE THESE
3/8/22, 4:06 PM, String Value
3/8/22, 4:12 PM, String Value
3/8/22, 4:12 PM, String Value
3/8/22, 4:13 PM, String Value
3/8/22, 4:14 PM, String Value
3/8/22, 4:14 PM, String Value
UPDATED FILE TO ONLY CONTAIN THESE
3/8/22, 4:15 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:15 PM, String Value
3/8/22, 4:17 PM, String Value
3/8/22, 4:17 PM, String Value
I have found a few example of using "seek" and found some examples using pointers to get the position, but those examples were very simple search for specific word/string and wasnt able to use my data to accomplish the same thing.
In my case i need to match the date and time to find that row, then delete everything above that row. And in the above case, which is possible, i need to make sure that it deletes above the first row found with that date/time combo..