I need to reorder the columns of this (tab-separated) data:
1 cat plays
1 dog eats
1 horse runs
1 red dog
1 the cat
1 the cat
so that is prints like:
cat plays 1
dog eats 1
horse runs 1
red dog 1
the cat 2
i have tried:
sort [input] | uniq -c | awk '{print $2 "\t" $3 "\t" $1}' > [output]
and the result is:
1 cat 1
1 dog 1
1 horse 1
1 red 1
2 the 1
Can anyone give me some insight on what is going wrong? Thank you.