Valhalla1 Posted April 22, 2008 Share Posted April 22, 2008 I've got a text file that consists of 1 line with a few letters/numbers, followed by a TAB, followed by some numbers is it possible to get autoit to delete the TAB and everything after it, leaving just the characters that preceded the TAB also once I've got that, how could I have it add line breaks in between every two characters. For example I'd have 2s5cThJs[TAB]5.3322 I'd like it first to chop the tab and trailing numbers, leaving 2s5cThJs then add the line breaks giving you 2s 5c Th Js Link to comment Share on other sites More sharing options...
zorphnog Posted April 22, 2008 Share Posted April 22, 2008 (edited) #include <File.au3> Global $aInfile, $hOutfile, $sLeft, $i If Not _FileReadToArray("test.txt", $aInfile) Then ConsoleWrite("!>Unable to read file" & @LF) Exit EndIf $hOutfile = FileOpen("newtest.txt", 2) If $hOutfile = -1 Then ConsoleWrite("!>Unable to open output file" & @LF) Exit EndIf For $i=1 To $aInfile[0] $sLeft = StringLeft($aInfile[$i], StringInStr($aInfile[$i], @TAB)-1) Do FileWriteLine($hOutfile, StringLeft($sLeft, 2)) $sLeft = StringTrimLeft($sLeft, 2) Until StringLen($sLeft) < 2 If $sLeft <> '' Then FileWriteLine($hOutfile, $sLeft) Next FileClose($hOutfile) Edited April 22, 2008 by zorphnog Link to comment Share on other sites More sharing options...
Valhalla1 Posted April 22, 2008 Author Share Posted April 22, 2008 thanks.. I dunno how u guys are so good 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