Jump to content
Sign in to follow this  
euverve

Delete a line that starts with "\"

Recommended Posts

euverve

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
foster74

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
euverve

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.