I have a text file that has file names on each line and I would like to use autohotkey to clean up the file and remove every line that ends in ".zip". How would I go about doing this?
Remove lines in text file that end in ".zip"
Started by
mapleboy
, Jul 19 2012 04:17 AM
4 replies to this topic
#1
mapleboy
Posted 19 July 2012 - 04:17 AM
#2
Posted 19 July 2012 - 04:36 AM
You may use Loop [read file contents] and InStr().
If you're not familiar with the syntax, start here.
If you're not familiar with the syntax, start here.
#3
Posted 19 July 2012 - 01:23 PM
FileRead, var, test.txt FileDelete, test.txt FileAppend, % RegExReplace(var, "`am).*\.zip\r\n"), test.txt
#4
Posted 19 July 2012 - 11:34 PM
Slight adjustment to that:
FileRead, var, test.txt FileDelete, test.txt FileAppend, % RegExReplace(var, "`am).*\.zip[color=#FF0000](?:\v+)?[/color]"), test.txt [color=#00BF00]; vertical whitespace should match optionally in the event that a ".zip" line is the last line in the file[/color]
#5
Posted 20 July 2012 - 02:15 AM
Or using Hugof's TF (<!-- m -->http://www.autohotke...ugov/tf-lib.htm<!-- m -->)
TF_Replace("File.txt",".zip")




