I have a code like this -
> for line in `cat file.txt`;do
/*if line-1 dosomething-1 */
/*if line-2 dosomething-2 */
/* if line-3 dosomething-3 */
//Parsing 3 lines I开发者_Python百科 would like to remove them from file - how to do that?
//Parse - line4
//Parse - line5
//Parse - line6
//now delete above 3 lines again & repeat the process till eof.\
done
I just need to delete the lines after its processed
You can't change a file as you're reading it, so you'll need to output the entries you want to keep to a new file (or stdout), and skip the entries you don't. Then the resulting file can be processed further with only the kept lines.
精彩评论