删除最后五行

#!/bin/bash
#---------cutting file----------
IN=/share1/projects/project_mwr/tophat_result
#filename=$IN/Sample_ZJ-GFP-/countlist.txt
filename=$IN/Sample_ZJ-GFP+/countlist.txt
#---------cuttint last lin -----
cutnu=5
cutnum=`expr $cutnu - 1`
filetmp=`cat $filename|wc -l`
filelen=`expr $filetmp - $cutnum`
fileend=`cat $filename|wc -l`d
sed -i "$filelen,$fileend" $filename
echo "cut the last 5 line finished!"

 

posted @ 2012-12-24 10:54  蒋蒋  阅读(197)  评论(0编辑  收藏  举报