Is there a way to get the total number of lines that filters by certain parameters? For example, I have a log file that contains:
COMPLETED: location: DEN brand: A
COMPLETED: location: LHR brand: A
COMPLETED: location: EWR brand: C
COMPLETED: location: DEN brand: A
COMPLETED: location: LHR brand: B
COMPLETED: location: JFK brand: C
Is there a way to write the grep command that can return the total number of lines for each location and brand. For example, the command executed would return
DEN A 3
LHR A 1
LHR B 1
This would have to be dynamic since the locations can be different. So we can't just do something like grep 'location: DEN' | grep 'brand: A' | wc -l >> file.log
Any suggestions would be helpful. Thanks.