當前位置:編程學習大全網 - 電腦編程 - linux文件合並,關鍵字去重復shell腳本

linux文件合並,關鍵字去重復shell腳本

#! /bin/bash

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

這個腳本已經可以把文件按照妳要求合並了,不過按照時間字段比較我壹時還沒想出來怎麽弄,請高手補充吧

  • 上一篇:斯克雷諾怎麽發音?
  • 下一篇:醫學上血液安卡檢查是什麽意思
  • copyright 2024編程學習大全網