-3

I have a log file containing more than 100000 lines similar to the following

2016-11-08 17:04:01|x.x.x.x|xxxxxxxxxxxxx|x.x.x.x|1002|xxxx|xxxxxx|1|2|https://xxxxxxxxx/xxxxxxx/xxxxxxx/xxxxxx{"status":500,"body":""}
2016-11-08 17:04:02|x.x.x.x|xxxxxxxxxxxxx|x.x.x.x|1003|xxxx|xxxxxx|1|2|https://xxxxxxxxx/xxxxxxx/xxxxxxx/xxxxxx{"status":400,"body":""}

Please help me to write a script that will return a count of lines only with "status":500.

Ruslan Osmanov
  • 20,486
  • 7
  • 46
  • 60
lfreez
  • 77
  • 8

1 Answers1

1

Try grep -c "\"status\":500 /path/to/logfile.dat

oliver
  • 2,467
  • 3
  • 14
  • 29