[ale] cut
Keith Hopkins
hne at hopnet.net
Sat Mar 9 11:30:01 EST 2002
David S. Jackson wrote:
> Hi
>
> I'm trying to come up with a command line that takes the shell's
> history and cuts everything after the first space, uniq -c's it,
> then sorts by which commands appear the most. The idea is to
> tell you which commands appear most in your history and by how
> much.
>
> Something like: history 1000 | cut ?? | uniq -c | sort
>
>
> What I'm having trouble with is the cut switch that removes
> everything after the first space.
>
> I've tried cut -d' ' -f1, but it doesn't work for some reason.
>
> Any ideas out there?
>
> TIA!
>
>
"cut" just doesn't seems to cut it, so....
history 1000 | awk '{print $2}' | sort | uniq -c | sort -nr | head
note: uniq - remove duplicate lines from a SORTED file
you get very different results if you don't sort before the uniq.
Lost in Tokyo,
Keith
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list