tonycst Posted December 8, 2014 Share Posted December 8, 2014 Can you guys help me ? I have a large text file that has ";string-name" in its lines in multiple places. I need to replace that line with something else in the entire file and write the file. Link to comment Share on other sites More sharing options...
Geir1983 Posted December 8, 2014 Share Posted December 8, 2014 $File = FileRead(@ScriptDir & "\filename.txt") StringReplace($File, ";string-name", "replace text") Link to comment Share on other sites More sharing options...
JohnOne Posted December 8, 2014 Share Posted December 8, 2014 FileRead StringReplace FileWrite AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
tonycst Posted December 8, 2014 Author Share Posted December 8, 2014 (edited) Thanks. Love your avatar John. Edited December 8, 2014 by tonycst Link to comment Share on other sites More sharing options...
JohnOne Posted December 8, 2014 Share Posted December 8, 2014 Yours is good too, I used to have one just like it. computergroove 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jguinch Posted December 8, 2014 Share Posted December 8, 2014 (edited) To replace each entire line : $sContent = FileRead("file.txt") $sSearch = ";string-name" $replaceTxt = "new text " StringRegExpReplace($sContent, "(?:\A|\R)(\N*\Q" & $sSearch & "\N*)", $replaceTxt) Edited December 8, 2014 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now