每天一个小练习--join,sed

使用join连接字段。

#cat a

#
# d
susan   150
wxw     132
rose    228
lee     595

$cat b

# date
# li ang
susan   100
lee     200
wxw     150
rose    300

#cat merge.sh

#! /bin/sh
# merge.sh
sed '/^#/d' $1 | sort > $1.sorted
sed '/^#/d' $2 | sort > $2.sorted
join $1.sorted $2.sorted
rm $1.sorted $2.sorted

#./merge.sh a b

lee 595  200
rose 228 300
susan 150 100
wxw 132 150


你可能感兴趣的:(JOIN,sed)