Script to filter output from `uniq -c` to only items that appear more than `--frequency=n` times.
This file contains 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
#!/bitly/local/bin/python | |
import tornado.options | |
import logging | |
import sys | |
if __name__ == "__main__": | |
tornado.options.define("frequency", type=int) | |
tornado.options.parse_command_line() | |
for line in sys.stdin: | |
if not line: | |
continue | |
try: | |
n, extra = line.strip().split(" ", 1) | |
if int(n) > tornado.options.options.frequency: | |
sys.stdout.write(line) | |
except: | |
logging.exception('error reading line %r', line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment