Sign in to follow this  
Followers 0
sublimnl

Stupid notepad and _ReplaceStringInFile question

3 posts in this topic

Does anyone know how notepad writes a new line? For example I have

"i hate the spurs

and the mavs"

in a file that was created with notepad and I want to get rid of the first line. I have tried the following without success...

_ReplaceStringInFile($file,"i hate the spurs" & @CRLF,"")

I have also tried @CR and @LF but nothing seems to work...it just doesn't find the string so nothing happens. How can I accomplish this?

Share this post


Link to post
Share on other sites



Look in FileWriteLine() and FileRead(), you can choose the mode to start writing at the end of the file by starting a new line.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Look in FileWriteLine() and FileRead(), you can choose the mode to start writing at the end of the file by starting a new line.

Thanks, but not sure how that will help. I gave a very basic example, but I am searching through quite a large file and need to delete the line of text I am searching for as well as the carriage return or line feed. So basically for a more complex example if I have

1111

2222

3333

4444

5555

and want to get rid of "3333" I cannot have a space where the line used to be. I have to end up with

1111

2222

4444

5555

I can't believe I am stuck on something so easy!

Edited by sublimnl

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