我有一个这样的代码-
> 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 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我只需要在处理后删除行
发布于 2011-01-27 13:33:29
你不能在读文件的时候改变它,所以你需要把你想要保存的条目输出到一个新文件(或stdout)中,并跳过你不想要的条目,这样得到的文件就可以用保留的行进行进一步的处理。
https://stackoverflow.com/questions/4813060
复制相似问题