CADghost 发表于 2004-9-25 17:26:00

外部文件中数据的删除问题

。。。。。。


(1 (ABC BCD) (AA BCSA) (ADB))


(4 (AAC BBCD) (AA BCSA) (ADB))


。。。。。。


这是一个TXT文件,还有很多行这样的数据,如何在删除第一个字符为“1”的那行数据?


有没有一个简单的办法呢?

xyp1964 发表于 2004-9-25 20:22:00

;;;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]
查看完整版本: 外部文件中数据的删除问题