Skip to content

Commit

Permalink
delete leading junk before attempting JSON decode
Browse files Browse the repository at this point in the history
- This is so when grepping multiple files or recursively grepping
  directories, you don't have to add the -h flag to grep to prevent
  it from prepending filenames to the matching lines.
  • Loading branch information
hoytech committed May 14, 2014
1 parent 824a02b commit cd050c2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions bin/log-defer-viz
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ while (my $file = shift) {
my $entry;

try {
$_ =~ s/^[^{]+//; ## grep -r prepends filename (this is so you don't to remember the the -h flag)
$entry = decode_json($_);
} catch {
if ($opt->{verbose}) {
Expand Down

0 comments on commit cd050c2

Please sign in to comment.