I would like to format the output from the log file to a single line using BASH:
Log output:
# egrep "^(Infected|Cleaned)" /var/log/scan.log
Infected: files - 0, objects 0
Cleaned: files - 0, objects 0
I was able to print the results on one line but I'm not sure how I can format it and remove spaces:
# egrep "^(Infected|Cleaned)" /var/log/scan.log | awk '/Infected/{if (x) print x; x="" } { x = (!x) ? $0 : x "; " $0 } END { print x }'
Infected: files - 0, objects 0; Cleaned: files - 0, objects 0
Desired format:
Infected:F-0, O-0; Cleaned:F-0, O-0"