若用linux-like 系統
可以寫 shell script
#!/bin/bash
dir="your text file dir"
output="out.o"
for i in $dir/*
do
#get file name
filename=${i##*/}
#remove 附檔名
filename=${name%.*}
#output filename into $output
echo $filename >> $output
#get the line which in last fifth.
tail -n 5 $i | head -n 1 >> $output;
done
ps. windows下可灌cygwin