0
我有這樣的代碼 -如何在閱讀文件後刪除文件中的行?
> 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
我只需要後刪除線及其加工
如果您可以使用Perl,這個問題的答案可以幫助您:http://stackoverflow.com/questions/4732937/how-do-i-read-a-file-line-by-line-while-modifying -lines-as-needed/4733306#4733306 – eckes 2011-01-27 07:50:05