a command-line tool for text search, sepcially for logid searching. you can use logid group the muliti-lines merge to a one record.
seek multi condition for log scanning:
ggrep --group 'LogId\[[:logid:]\]' --grep 'LOG1' --grep 'LOG2' --orderly-match demo/demo.log
log-content:
20240119 LogId[111] LOG1
20240119 LogId[111] LOG2
20240119 LogId[111] LOG3
50240119 LogId[222] LOG1
output
20240119 LogId[111] LOG120240119 LogId[111] LOG2
50240119 LogId[222] LOG1
merge multi-lines to a line for logid
cat demo/demo.log|ggrep --group 'LogId\[[:logid:]\]' --grep 'LOG1' --grep 'LOG2' --merge-lines --color=always
log-content:
20240119 LogId[111] LOG1
20240119 LogId[111] LOG2
20240119 LogId[111] LOG3
50240119 LogId[222] LOG1
output
20240119 LogId[111] LOG120240119 LogId[111] LOG2
50240119 LogId[222] LOG1
test group match
cat demo/demo.log|ggrep --group 'LogId\[[:logid:]\]' --color=always|head
ggrep --smart-logid --print-group --grep 'LOG2' --full-match --color always demo/demo.log
output:
20240119 LogId[111] LOG1
20240119 LogId[111] LOG2
20240119 LogId[111] LOG3
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/lingdor/ggrep/HEAD/install.sh)"
or
go install github.com/lingdor/ggrep@latest
or download your release versions: Releases.