ggrep

command module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 18 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL