|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Deleting Text from a Text File
i would like to delete a specific line of a text file. for instance, if the line i'm looking for is "abc", then i'd like to delete that line only (all the lines are unique).
is it possible to do this? or would it be easier/better to read all the lines into an array, delete the file, recreate the file with the lines from the array, skipping over the line i don't want? any help is greatly appreciated. thanks. |
|
#2
|
||||
|
||||
|
In short: Read the file into a string - delete the file - replace the string - rewrite the file.
I believe this would be the easiest and the fastest way to delete a line of code. Im sure there are other ways....
__________________
PEACE! |
|
#3
|
|||
|
|||
|
I agree. Although I have done this with PERL and not ASP, you would have to match the string somewhere, as WG says.
open file for reading while you have a file if the line is not what you want save lines end if end while close file for reading open temporary file while you have a file save lines from above end while close file |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Deleting Text from a Text File |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|