外部文件中数据的删除问题
。。。。。。(1 (ABC BCD) (AA BCSA) (ADB))
(4 (AAC BBCD) (AA BCSA) (ADB))
。。。。。。
这是一个TXT文件,还有很多行这样的数据,如何在删除第一个字符为“1”的那行数据?
有没有一个简单的办法呢? ;;;sjsc.lsp<BR>;;;C:sjsc 数据删除<BR>;;;删除第一个字符为“(1”的那行数据<BR>(defun c:sjsc(/ oldfile newfile txt)<BR> (setq oldfile (open "aaa.txt" "R"));;;aaa.txt为原有数据文件<BR> (setq newfile (open "new.txt" "W"));;;new.txt为新建数据文件<BR> (while (setq txt (read-line oldfile))<BR> (setq txt (substr txt 1 2))<BR> (if (/= txt "(1")(write-line txt newfile))<BR> )<BR> (setq oldfile (close oldfile)<BR> newfile (close newfile)<BR> )<BR> )
页:
[1]