filea=a.txt
fileb=b.txt
n=0
m=0
while read linea
do
let "n=n+1"
noa1=`echo $linea|awk -F "|" '{print $1}'`
while read lineb
do
let "m=m+1"
nob1=`echo $lineb|awk -F "|" '{print $1}'`
nob2=`echo $lineb|awk -F "|" '{print $2}'`
if [ "$noa1" = "$nob1" ]
then
echo "${linea}|${nob2}">>c.txt
fi
done<$fileb
done<$filea
這個腳本已經可以把文件按照妳要求合並了,不過按照時間字段比較我壹時還沒想出來怎麽弄,請高手補充吧