Jump to content

Check new file against old file - Replace only lines with specific text


Recommended Posts

I have a system in place that check files. It checks for file dates modified in the last 24 hours. It works fine. What I want to do is to do multiple checks during the course of the day.

So what needs to happen is I check the files at 8am and "oldfile" as example is created. Test4 is missing.

At 9am I check the files again and Test4 has been created and now I have the file with date.

But now I want the output/updated file to display only the where true files/lines

 

Any help will be appreciated

 

image.thumb.png.16e2dc65bfab0773b53911ec94e08974.png

Link to comment
Share on other sites

Not sure I correctly understood the question. The expected result is not clear

;$txt = FileRead("test.txt")
$txt = "Test1 - c:\Logs" & @crlf & _ 
    """test1.txt"" 2022/07/19 13:35:46" & @crlf & _ 
    @crlf & _ 
    "Test2 - c:\Logs" & @crlf & _ 
    """test2.txt"" 2022/07/19 10:20:39" & @crlf & _ 
    @crlf & _ 
    "Test3 - c:\Logs" & @crlf & _ 
    "file not found or outdated" & @crlf & _ 
    @crlf & _ 
    "Test4 - c:\Logs" & @crlf & _ 
    """test4.txt"" 2022/07/19 10:31:39"
Msgbox(0,"", $txt)

$txt2 = StringRegExpReplace($txt, '.+\Rfile not found.+\s*', "")
Msgbox(0,"", $txt2)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...