Vadoff Posted November 16, 2008 Share Posted November 16, 2008 How would I be able to replace the 5th line, "Guys", with "Girls"? Hello How Are You Guys Today ? Filewriteline seems to only be able to tack on lines at the end of a file. There's thousands of lines in the actual txt file I want to manipulate, so rearranging the lines isn't really practical solution either. Link to comment Share on other sites More sharing options...
rasim Posted November 16, 2008 Share Posted November 16, 2008 Vadoff$sFile = @ScriptDir & "\test.txt" $sRead = FileRead($sFile) $aString = StringSplit($sRead, @CRLF, 1) $aString[5] = StringReplace($aString[5], "Guys", "Girls") $sRead = "" For $i = 1 To $aString[0] $sRead &= $aString[$i] & @CRLF Next $hFile = FileOpen($sFile, 2) FileWrite($hFile, $sRead) FileClose($hFile) Link to comment Share on other sites More sharing options...
z0mgItsJohn Posted November 16, 2008 Share Posted November 16, 2008 O: Theres A Function Called " _FileWriteToLine () '' #Include <File.au3> _FileWriteToLine($sFile, $iLine, $sText[, $fOverWrite = 0]) Search The Function In The Help File For More Help ^.^ ~~ Hope I Helped ~~ - John Latest Projects :- New & Improved TCP Chat 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