beginning in java, i'm trying to delete specific line from a text file. Ex: i want to delete data between line 10 and 20 and between line 20 and 30.
or i want to specify line number that i want to delete.
how could it be possible with java. thanks a lot
This may not be the optimized one, but this works.
Iterate over the lines in the old file (probably using a BufferedReader)
1.For each line, check if it matches what you are supposed to remove 2.If it matches, do nothing 3.If it doesn't match, write it to the temporary file