linux shell
来源:互联网 发布:linux下源码安装mysql 编辑:程序博客网 时间:2024/06/06 17:37
#!/bin/shfor line in $(cat all_files.txt)doif [ -f "$line" ]; #A folder like /tmp/a/b is also true for -e, there is a whitespace before and after "-f".thensed 's/abc/def/g' $line >> ${line%.*}.$(date +%Y_%M_%d).fix #elseecho "$line" >> files_not_found.txtfidone
shell读取文件的一个更加高效的方法,有两个优势:1.不用创建管道;2.不用开启cat进程。
<pre name="code" class="java">while read -r linedo echo $linedone < all_files.txt
0 0
- Linux Shell
- Linux Shell
- Linux Shell
- Linux Shell
- Linux Shell
- Linux Shell
- linux shell
- Linux Shell
- Linux Shell
- Linux Shell
- Linux Shell
- linux shell
- LINUX SHELL
- Linux Shell
- Linux Shell
- Linux shell
- linux shell
- Linux Shell
- HDU1039 Easier Done Than Said?
- s3c2440 的 rtc 操作
- 堆
- 非多项式CRC16校验算法
- UVa 348 Optimal Array Multiplication Sequence (DP 最优矩阵链乘)
- linux shell
- The Python Conceptual Hierarchy
- xcode6 beta6.dmg 下载地址
- C语言位运算符
- 编写简单的网络爬虫 (python3.2)
- 欢迎光临我的博客
- ios构造httpPost头结构
- shell 变量
- 外部排序 之 概念篇