Created
September 19, 2013 06:48
-
-
Save daneharrigan/6619853 to your computer and use it in GitHub Desktop.
For parsing key-value pairs out of log streams.
Example: heroku logs --tail | ./kgrep service
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
#!/usr/bin/env perl | |
# | |
# Usage: echo "key=value" | kgrep key | |
# | |
while($line = <STDIN>) { | |
if($line =~ m/($ARGV[0]+=[^\s]*)/) { | |
print "$1\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment