Back to problems

Write a Shell Script

Algorithm · ByteDance · Medium

Write a bash program that consumes log entries from standard input and emits summarized results. Input The input contains any number of records, with each valid record written as: LEVEL may be INFO, WARN, or ERROR. Reading stops when EOF is reached. Output For every SERVICE, total its ERROR records and print the services in decreasing order of that total: When two services have equal totals, place the alphabetically earlier service name first. Constraints The input can…

Checking your access…