Skip to content

Instantly share code, notes, and snippets.

@daneharrigan
Created September 19, 2013 06:48
Show Gist options
  • Save daneharrigan/6619853 to your computer and use it in GitHub Desktop.
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
#!/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