it's a tool for searching files and their contents
imagine you want to find all instances of the word "error" in log files within a directory /var/logs
.
./grop "error" /var/logs
/var/logs/app.log: line 32: "there was an error connecting"
/var/logs/app.log: line 45: "critical error: could not connect"
/var/logs/system.log: line 12: "unexpected error at line 12"
consider you want to find all instances of the word "john" from another program's output.
echo -e "glazed\nchocolate\nfilled" | ./grop "glazed"
line 1: "glazed"
to search the contents of a specific file, you can use a combination of cat
and grop
. for instance, to search for "donut" in myfile.txt
:
cat myfile.txt | ./grop "donut"
line 10: "this is some donut in the middle"
line 21: "donut is found again here"
MIT License 2023 donuts-are-good, for more info see license.md