Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のフラットファイルがあり、各ユーザーの最初の列のすべてのポイントの合計を決定したいと思います。例えば:
50 user1 100 user2 10 user1 20 user3
戻ります
60 user1 100 user2 20 user3
このbashを実行することは可能ですか?
#!awk -f { foo[$2] += $1 } END { for (bar in foo) print foo[bar], bar }
awk '{a[$2]+=$1}END{for(i in a )print a[i],i}' your_file