Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # I want to know what I should automate more.
- # List the commands I re-type most often.
- EXISTING_SHORTCUTS='abcefhlgrz'
- # Annotated:
- grep \
- --perl-regexp `# Use perl compatible regular expression syntax` \
- --invert-match `# Show lines that don't match`\
- "^[$EXISTING_SHORTCUTS]( |$)" `# Select lines that don't use an existing shortcut` \
- ~/.bash_history \
- | sort | uniq --count `# List repeated items by frequency` \
- | sort --numeric-sort `# Sort by frequency`
- # Abbreviated:
- # grep -Pv "^[$EXISTING_SHORTCUTS]( |$)" ~/.bash_history | sort | uniq -c | sort -n
Add Comment
Please, Sign In to add comment