[Solved] How to search and replace a variable value from a list in text file?

To read lines from a file one at a time and then remove that line and repeat the process until there are no more lines left you should take a look at my subroutine that I posted here;

To create the “log” you can simply append the line you got from the subroutine to a file of your choosing using the Append to File action action:Write to a File [Keyboard Maestro Wiki]

I’ll also point you to a very similar question you asked before:

To demonstrate the use of the subroutine, here's a macro I've put together that does what you're asking:

Download Macro(s): Test Read File Line by Line and Log.kmmacros (4.6 KB)

Macro-Image

Keyboard Maestro Export

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 10.15.7
  • Keyboard Maestro v10.2

Please note the following:

  1. You need to download and install the subroutine I linked to above.
  2. The two actions coloured red need to be filled in with your two filename paths: the first the input file and the second the log file.
  3. The group action coloured orange - you will need to put your desired processing of each line of text obtained from the file here. The variable containing the text is called Local__LineToProcess

I hope you find this useful.