cypher175 Posted December 27, 2008 Share Posted December 27, 2008 Is there anyway to Copy Specific Lines of text from a .txt file into Another txt. File..?? Link to comment Share on other sites More sharing options...
cypher175 Posted December 27, 2008 Author Share Posted December 27, 2008 Any body know..?? Link to comment Share on other sites More sharing options...
herewasplato Posted December 27, 2008 Share Posted December 27, 2008 Wait at least 24 hours before bumping your own topic/thread. It is best to spend more time on you original post. One single sentence is rarely enough info for us to know what you need/want in the say of help. In this case, do you know the line number of the info to be copied or are you going to have to look for info on each line to determine if it should be copied? [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
cypher175 Posted December 27, 2008 Author Share Posted December 27, 2008 I just need to copy all the lines of text after line 10 in a text file to another text file.. Link to comment Share on other sites More sharing options...
BinaryBrother Posted December 27, 2008 Share Posted December 27, 2008 (edited) I just need to copy all the lines of text after line 10 in a text file to another text file.. I noticed you have over 100 posts so I'm assuming you've tried already... Look at $ReadFile = "C:\File to Read.txt" $WriteFile = "C:\File to Write.txt" $Max = _FileCountLines($ReadFile) For $N = 10 to $Max Step 1 _FileWriteToLine($WriteFile,$N,FileReadLine($ReadFile,$N)) Next MsgBox(0,"Done","File is done...") NOT TESTED!! But should give you a good start? I hope this has helped, I usually don't try helping someone else... I'm usually asking the questions... lol Edited December 27, 2008 by BinaryBrother SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
rasim Posted December 27, 2008 Share Posted December 27, 2008 I just need to copy all the lines of text after line 10 in a text file to another text file..The fast method: $sFile = @ScriptDir & "\test.txt" $sRead = FileRead($sFile) $aStrings = StringSplit($sRead, @CRLF, 1) If $aStrings[0] < 11 Then Exit $sResult = "" For $i = 11 To $aStrings[0] $sResult &= $aStrings[$i] & @CRLF Next $hFile = FileOpen(@ScriptDir & "\result.txt", 2) FileWrite($hFile, $sResult) FileClose($hFile) Link to comment Share on other sites More sharing options...
herewasplato Posted December 27, 2008 Share Posted December 27, 2008 I just need to copy all the lines of text after line 10 in a text file to another text file..Well, why didn't you say that in the firstplace? :-) :-) :-)@BinaryBrother,Just an FYI to explain a bit more about why rasim said "The fast method:"From the help file on FileReadLine:From a performance standpoint it is a bad idea to read line by line specifying "line" parameter whose value is incrementing by one. This forces AutoIt to reread the file from the beginning until it reach the specified line.I'm not critizing your code, just informing. [size="1"][font="Arial"].[u].[/u][/font][/size] 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