合并多个文件脚本
#!/bin/bash
##file_name
_transfer_name=/home/zcx/test/
target_file=all.txt
echo "startng..........................."
if [ -e "$target_file" ];
then
`rm -f "$target_file"`
echo "all.txt alread exist,has been delete"
else
echo "all.txt not exists"
fi
file_list=`ls "${_transfer_name}"*.txt`
for file in $file_list
do
##fileline_number
file_line_count=`cat $file | wc -l`
end=$(expr $file_line_count - 1)
`sed -n '2,'$[end]'p' $file >>all.txt`
done
##`sed -n '2,$p' "$file_list" >> all.txt`
echo "end.............................."
本文来自博客园,作者:diablo-427,转载请注明原文链接:https://www.cnblogs.com/diablo-427/p/16692398.html