in reply to Re: Delete Lines Across Multiple Files
in thread Delete Lines Across Multiple Files

@haukex: thanks for the advice I will try that. If I load 3 files and the data is only in 2 files will my 3rd file become blank? or will it be left alone? Thanks!

  • Comment on Re^2: Delete Lines Across Multiple Files

Replies are listed 'Best First'.
Re^3: Delete Lines Across Multiple Files
by haukex (Archbishop) on Dec 31, 2020 at 17:40 UTC
    If I load 3 files and the data is only in 2 files will my 3rd file become blank? or will it be left alone?

    The code you wrote, which I just put in the loop, just does this: split the line on colons, check if the second and third fields match certain values and if yes skip that line via next, otherwise write the line back out via print. In other words, it will delete the lines that match the condition, all the other lines remain unchanged. This is true for any file the code processes. This is the advantage of the loop, you know every file will be treated exactly the same - unless of course there's a fatal error on one of the files, in which case the rest won't be processed, but there are ways to handle that too.

    Minor edits.