この (タブ区切りの) データの列を並べ替える必要があります。
1 cat plays
1 dog eats
1 horse runs
1 red dog
1 the cat
1 the cat
つまり、次のように出力されます。
cat plays 1
dog eats 1
horse runs 1
red dog 1
the cat 2
私が試してみました:
sort [input] | uniq -c | awk '{print $2 "\t" $3 "\t" $1}' > [output]
結果は次のとおりです。
1 cat 1
1 dog 1
1 horse 1
1 red 1
2 the 1
何がうまくいかないのか、誰かが私に洞察を与えることができますか? ありがとうございました。