Last active
December 4, 2016 05:54
-
-
Save koki-h/2e65255f0d9b9c750edb02de18951dd9 to your computer and use it in GitHub Desktop.
ファイルaaaから1,8カラム目を取り出し、1カラム目をキーとして同じキーを持つデータを横で持つようにするワンライナー
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cut -f1,8 aaa | ruby -na -e 'require "pp";BEGIN{h={}}; h[$F[0]] ||= [];h[$F[0]] << $F[1]; END{pp h}' |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-e オプションに渡すrubyスクリプトはシングルクォーテーションで囲むのが無難。ダブルクォーテーションでも実行できるが$をエスケープする必要がある。