newLISP文件合并
来源:互联网 发布:淘宝比价软件 编辑:程序博客网 时间:2024/06/12 07:54
需求是几百个文件,命名规则类似下面的文件名:
dailydata_20140320.txt
通过newLISP合并,首先是自动生成这些文件名,然后用read-file读取内容,再用append-file写入到一个文件中。
注意删除上次运行的结果,也要注意有文件不存在的话需要出error.log日志。
代码如下:
#!/usr/bin/newlisp(set 'start-date "20140101 00:00")(set 'start-seconds (date-parse start-date "%Y%m%d %H:%M"))(set 'day-seconds (* 3600 24))(if (file? "20140101_20140828.txt") (delete-file "20140101_20140828.txt"))(if (file? "error.log") (delete-file "error.log"))(set 'x 0)(while (< x 240) (begin (set' compute-date (date (+ (* day-seconds x) start-seconds) 0 "%Y%m%d")) (set 'file-name (string "dailydata_" compute-date ".txt")) (if (file? file-name) (begin (set 'file-content (read-file file-name)) (print file-content) (append-file "20140101_20140828.txt" file-content) ) (append-file "error.log" (string file-name " does not exist"))) (inc x) ))(exit)
0 0
- newLISP文件合并
- newlisp文件作为脚本运行
- newlisp读取文件性能测试
- newlisp按行处理日志文件
- 用newlisp开发网站二 静态文件路由
- 文件合并
- 合并文件
- 文件合并
- 文件合并
- 文件合并
- 文件合并
- 文件合并
- 合并文件
- 文件合并
- newLISP语法
- newlisp 异常
- newlisp debugger
- newLISP symbol
- App Store审核指南中文版(2014.9.10更新):新增Apple Pay相关内容
- leetcode: Spiral Matrix
- 平台调用P-INVOKE完全掌握, 反汇编细解结构体作为返回值
- 学习boost库手册
- javaIterator 、Vector、ArrayList、List 使用深入剖析
- newLISP文件合并
- 平台调用P-INVOKE完全掌握(完结篇),自定义Mashaler
- 用haproxy+redis实现分布式redis服务器
- MP Initialization Protocol Algorithm for Intel Xeon Processors
- 苹果列出了app被拒最常见原因,你中枪了吗?
- android 线程进程机制
- python装饰器之staticmethod,classmethod,property
- github本地如何上传代码
- 路径