awk 如何找出兩檔案相同字串 - Linux
By Cara
at 2010-03-18T15:02
at 2010-03-18T15:02
Table of Contents
while read line1
do
temp1=$(echo $line1 | awk '{print substr($1,1,3)}')
while read line2
do
temp2=$(echo $line2 | awk '{print substr($1,1,3)}')
[ $temp1 == $temp2 ] && echo $line2 $line1 >> c.txt
done < a.txt
done < b.txt
exit 0
這樣做大概可以解決
但是效率很差
而且當我資料很多筆時
不知道為什麼只做完其中一筆就卡住了
line1 跟 line2 太長還會被換到下一行
--
--
Tags:
Linux
All Comments
By Mary
at 2010-03-22T10:29
at 2010-03-22T10:29
By Bennie
at 2010-03-23T02:58
at 2010-03-23T02:58
By Erin
at 2010-03-26T02:12
at 2010-03-26T02:12
By Kumar
at 2010-03-29T06:34
at 2010-03-29T06:34
By James
at 2010-04-01T13:29
at 2010-04-01T13:29
By Sierra Rose
at 2010-04-02T03:44
at 2010-04-02T03:44
By Sierra Rose
at 2010-04-04T09:18
at 2010-04-04T09:18
By Freda
at 2010-04-05T04:13
at 2010-04-05T04:13
Related Posts
如何重新定義機殼上的關機按鈕
By Genevieve
at 2010-03-18T13:55
at 2010-03-18T13:55
cpuz
By Sierra Rose
at 2010-03-18T13:35
at 2010-03-18T13:35
kopete
By Jessica
at 2010-03-18T11:07
at 2010-03-18T11:07
ubuntu 9.10 開機的錯誤訊息
By Leila
at 2010-03-18T10:26
at 2010-03-18T10:26
awk 如何找出兩檔案相同字串
By Doris
at 2010-03-18T10:12
at 2010-03-18T10:12