LoginSignup
5
5

More than 3 years have passed since last update.

joinコマンドでゼロ埋め

Last updated at Posted at 2014-10-17

目的

input
$cat list1
aaa     111
bbb     222
ccc     333
ddd     444

$cat list2
bbb     555
ccc     666
ddd     777
eee     888

上記の2ファイルを結合して下記のようにしたい。

output
aaa 111 000
bbb 222 555
ccc 333 666
ddd 444 777
eee 000 888

手順

$join -a 1 -a 2 -o 0,1.2,2.2 -1 1 -2 1  -e "000" <(sort list1) <(sort list2)
5
5
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5