Jump to content
Sign in to follow this  
tannerli

_FileCharacterReplace -> FileConversion.au3

Recommended Posts

tannerli

I had to do this at my workplace, if someone can use it... feel free to use it, but please do share any improvements and give me some feedback.

Performance:

I tested the function on a quit actual workstation (HP dc5700).

I used a txt-file with about 1.3million characters and I had to make 291'000 replacements.

The conversion took about 26seconds

Greetings tannerli

UPDATE:

I had to to even more statistics and reporting so I needed more functions to edit list and logfiles and I created these functions:

_FileLineAdd() ; Add a character or string to each line of a file

_FileLineSub() ; Cut a number of characters from all lines in a file

_FileCharacterReplace() ; Replace a certain character in a file

_FileDeleteLine() ; Delete all lines containing a certain substring in a file

_FileExtractLine() ; Extract all lines containing a certain substring in a file

FileCharacterReplace.au3

FileConversion.au3

Please report any experiences and bugs to me

Edited by tannerli

Share this post


Link to post
Share on other sites
Valuater

Looks Nice!!!

Maybe, For smaller files...

MsgBox(0x0,"",_FileCharacterReplace("C:\test.txt", ".", "[dot]"))

Func _FileCharacterReplace($file, $search, $replace)
    Return FileWrite($file & ".txt", StringReplace(FileRead($file), $search, $replace))
EndFunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
tannerli

30downloads and only 1 comment.... however...

Thx to Valuater for his comment, and maybe just as a Tipp:

Check the size of the file before you start a conversion, if its too big then it may take quite long

Share this post


Link to post
Share on other sites
tannerli

I hope someone can use the new functions

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  

×