多脚本合并

#!/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.............................."
posted @ 2023-01-02 21:55  diablo-427  阅读(11)  评论(0编辑  收藏  举报