明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1514|回复: 1

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

[复制链接]
发表于 2004-9-25 17:26:00 | 显示全部楼层 |阅读模式
。。。。。。


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


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


。。。。。。


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


有没有一个简单的办法呢?
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2004-9-25 20:22:00 | 显示全部楼层
;;;sjsc.lsp
;;;C:sjsc 数据删除
;;;删除第一个字符为“(1”的那行数据
(defun c:sjsc(/ oldfile newfile txt)
(setq oldfile (open "aaa.txt" "R"));;;aaa.txt为原有数据文件
(setq newfile (open "new.txt" "W"));;;new.txt为新建数据文件
(while (setq txt (read-line oldfile))
(setq txt (substr txt 1 2))
(if (/= txt "(1")(write-line txt newfile))
)
(setq oldfile (close oldfile)
newfile (close newfile)
)
)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-9-30 14:11 , Processed in 0.168321 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表