Last active
December 19, 2015 06:29
-
-
Save jrunning/5911644 to your computer and use it in GitHub Desktop.
Fun with IMDb data (http://www.imdb.com/interfaces)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Show ratings and reasons (e.g. "crude humor and language") along with the number of times they occur, e.g.: | |
| # | |
| # 270 R violence and language | |
| # 61 R strong sexual content | |
| # 58 PG-13 brief strong language | |
| # ... ... ... | |
| cat mpaa-ratings-reasons.list | | |
| sed --quiet --regexp-extended ' | |
| /^RE: rated/I !b # Match or skip to end of script | |
| h # Copy pattern space to hold buffer | |
| n # Copy next line to pattern space | |
| s/^RE: //I; !t # Remove "RE: " from beginning or skip to end of script | |
| H # Append pattern to hold buffer | |
| x # Swap pattern space and hold buffer | |
| s/\n// # Remove newline | |
| s/^RE: rated (\S+) for /\1\t/I # Replace e.g. "RE: rated PG-13 for " with "PG-13\t" | |
| p # Print result | |
| ' | | |
| sort | | |
| uniq --count --repeated | | |
| sort --numeric-sort --reverse --key=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment