Shell脚本,执行解释速度快.代码简单易于理解.在shell代码编写过程中,经常会用到读取文件内容. 写法一: ---------------------------------------------------------------------------- #!/bin/bash while read line do echo $line done < file(待读取的文件) ------------------------------------------
输入查找的文件夹路径,要查找的内容关键字(可以指定多个),要查找的文件类型(可以是多个),搜索出符合条件的文件,并记录所有符合条件的行号及行内容. 写的感觉有点冗余,但好歹还能使用^-^,主要是方便手头工作. # coding:utf8 import os from os.path import * # enter the search dir print r"""Search file tool(Ver1.0) dirpath /k keywords [/e fileext