-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwf.sh
More file actions
executable file
·27 lines (21 loc) · 840 Bytes
/
wf.sh
File metadata and controls
executable file
·27 lines (21 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# $Id: wf.sh 750 2012-11-11 00:13:47Z todd $
# 'classic' word freq
tr -c 0-9a-zA-Z '\n' | sort | uniq -i -c | sort -nr
exit 0
================================= wf spelled out:
tr -cs A-Za-z\' '\n' |
# Replace nonletters with newlines
tr A-Z a-z |
#Map uppercase to lowercase
sort |
#Sort the words in ascending order
uniq -c |
#Eliminate duplicates, showing their counts
sort -k1,1nr -k2 |
#Sort by descending count, and then by ascending word
sed ${1:-25}q
#Print only the first n (default: 25) lines
...
Use the following one liner to identify which command you execute a lot from your command line.
$ cat ~/.bash_history | tr "\|\;" "\n" | sed -e "s/^ //g" | cut -d " " -f 1 | sort | uniq -c | sort -n | tail -n 15