天天看点

巧用find命令 查找目录及子目录中所有htm或者html

每次需要大批量获取某个目录中及其子目录中所有的网页文件,需要写一段很长的shell脚本去查找,今天只用find命令就可以完成此项工作。比如查找 01/0f/ 中的所有htm 或者html

<code>find 01/0f  \(</code> <code>-name</code> <code>"*.htm"</code> <code>-o</code> <code>-name</code> <code>"*.html" \) | xargs ls</code> <code>-al</code><code>|awk '{print $9}' &gt;~/1114.txt</code>

获取此目录 htm 后者html 文件的路径(只显示文件名)输出到~/1114.txt 

继续阅读