Sign in to follow this  
Followers 0
QA Stooge

FileDeleteLine($file, $line) and related?

5 posts in this topic

#1 ·  Posted (edited)

I want to be able to, using File***(***) commands...

- insert text at some line in a file

- get a count for the number of lines in a file without traversing the whole thing

- delete a line in a file

- overwrite a line in a file

There a script that can do this sort of thing?

Edited by QA Stooge

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

well for numbers 1, 3, and 4 look at _FileWriteToLine in my sig, as for counting lines look at _FileCountLines in the help file

:o

~cdkid

;For deleting line 3 of a text file
_FileWriteToLine("c:\myfile.txt", 3, "", 1)
;For overwriting line 3 of a text file
_FileWriteToLine("c:\myfile.txt", 3, "My Replacement For Line 3", 1)
;for inserting text at line 3
_FileWriteToLine("c:\myfile.txt", 3, "Insert this where line 3 is and line 3 will move down 1 as will the rest of the lines", 0)
Edited by cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

for #2 use _FileCountLines

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You guys are gods.

Or at least saints.

Or at the VERY least, "kika$$OMFGLOLZ!!11!11!!!!!one!!!!eleven111!!"

Thanks a bunch!!!

Edited by QA Stooge

Share this post


Link to post
Share on other sites

Hi,

Also for huge files if too slow with usual AutoIt, consider;

1. _DeleteFoundLineDOS($s_file,$s_Exclude) (see doscoms link in signature)

2. WriteLineSQLSimple.au3 (see SQL UDF link in signature)

Best, Randall

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0