1. 給路徑下面所有.xls文件統(tǒng)計行數(shù)到一個count文件
wc -l *.xls* >>count.txt
若是在主路徑下有各分路徑,則可以這樣
wc -l */*.xls >>count.txt
2.給路徑下面所有文件進行合并
按照行合并:paste *...? >bind.txt
for file in *...; do echo "=== $file ==="; paste $file; done > all_variant.txt
按照列合并:cat *... >bind.txt
for file in *...; do echo "=== $file ==="; cat $file; done > all_variant.txt
3. 將壓縮文件解壓至指定路徑
unzip? -d /targetDir targetFile.zip
4. Linux中的通配符:https://www.cnblogs.com/lixuwu/p/7816335.html
*:? *5*指包含5的所有字符串; 5*?指5開頭的所有字符串;*5?指5結(jié)尾的所有字符串;*5?指以5為倒數(shù)第二個字符的字符串;
[]:[0-9]:所有以數(shù)字的字符;[1,2]: 1或者2;[!0-9]?:不是數(shù)字的字符
ls /etc/[!a-n]*.conf 列出/etc/目錄中不是以字母a到n開頭的,并且以.conf結(jié)尾的文件
ls /etc/[a-n]*.conf 列出/etc/目錄中以字母a到n開頭的,并且以.conf結(jié)尾的文件
ls /bin/[ck]* 列出以 c或k開頭的文件名
5. 路徑下包含XX字符的文件,替換其中的BB字符為CC
? ? ? ? ? ?for f in *XX*; do mv -i "$f" "${f//BB//CC}"; done