DATA=""
while read L
do
if [ "${L:0:1}" = "#" ]
then
echo -e "$DATA" # for check purpose
[ -n $DATA ] && /statistic_program "$DATA" # if there is data, process it (no data for the first occurence!)
DATA=$L # header, begin with a new set
else
DATA+="\n$L" # \n:newline
fi
done < input.txt
echo -e "$DATA" # for check purpose
/statistic_program "$DATA" # process the last set
Really thanks for your help, frans
I also not sure what is the problem about the code now
It seems like the problem this times is happened at the line below :