Skip to content
/ ggrep Public

a command-line tool for text search, sepcially for logid searching. you can use logid group the muliti-lines merge to a one record.

License

Notifications You must be signed in to change notification settings

lingdor/ggrep

Repository files navigation

ggrep

a command-line tool for text search, sepcially for logid searching. you can use logid group the muliti-lines merge to a one record.

demo

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

Print full group of log

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

install

/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.

About

a command-line tool for text search, sepcially for logid searching. you can use logid group the muliti-lines merge to a one record.

Resources

License

Stars

Watchers

Forks

Packages

No packages published