Sign in to follow this  
Followers 0
euverve

Delete a line that starts with "\"

3 posts in this topic

How could i delete a line in a text file that starts with a backslash?

Thanks

Share this post


Link to post
Share on other sites



Here's an example:

#Include <Array.au3>
#Include <File.au3>
$file1 = FileOpenDialog("Input", @scriptdir, "Text Documents (*.txt)", 1)
$file2 = FileOpenDialog("Output", @scriptdir, "Text Documents (*.txt)", 1)
Dim $array
_FileReadToArray($file1,$array)
Dim $NewArray[1]
For $i = 1 to $array[0]
   If Stringleft($array[$i], 1) <> "/" Then _Arrayadd($NewArray, $array[$i])
Next
_arraydelete($NewArray,0)
_FileWriteFromArray($file2,$NewArray)

Share this post


Link to post
Share on other sites

Here's an example:

#Include <Array.au3>
#Include <File.au3>
$file1 = FileOpenDialog("Input", @scriptdir, "Text Documents (*.txt)", 1)
$file2 = FileOpenDialog("Output", @scriptdir, "Text Documents (*.txt)", 1)
Dim $array
_FileReadToArray($file1,$array)
Dim $NewArray[1]
For $i = 1 to $array[0]
   If Stringleft($array[$i], 1) <> "/" Then _Arrayadd($NewArray, $array[$i])
Next
_arraydelete($NewArray,0)
_FileWriteFromArray($file2,$NewArray)
Thanks for the quick answer, it works...

Thanks for the help foster74.

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