mirror of
https://github.com/dchakro/brewlog.git
synced 2026-05-17 10:12:16 -07:00
code for searching the logfile
This commit is contained in:
parent
377c6fa52b
commit
0fd747cb77
1 changed files with 4 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ OPTIONS:
|
||||||
--brew-help Show brew commands (alias to "brew help")
|
--brew-help Show brew commands (alias to "brew help")
|
||||||
version Show brewlog version info
|
version Show brewlog version info
|
||||||
archive Archives the current log file as .xz (gzip as fallback if xz not found)
|
archive Archives the current log file as .xz (gzip as fallback if xz not found)
|
||||||
|
search [TERM] Searches for TERM in the logfile. (Uses grep)
|
||||||
tail [-n INT] Show the last "INT" lines from the log file.
|
tail [-n INT] Show the last "INT" lines from the log file.
|
||||||
(default: last 15 lines)
|
(default: last 15 lines)
|
||||||
|
|
||||||
|
|
@ -83,6 +84,9 @@ elif [ "$1" == "tail" ]; then
|
||||||
tail -n 15 "$LOGFILE"
|
tail -n 15 "$LOGFILE"
|
||||||
exit 0;
|
exit 0;
|
||||||
fi
|
fi
|
||||||
|
elif [ "$1" == "find" ]; then
|
||||||
|
# Listing all appearances of search term in the log file.
|
||||||
|
cat "$LOGFILE" | egrep "$2"
|
||||||
elif [ "$1" == "archive" ]; then
|
elif [ "$1" == "archive" ]; then
|
||||||
if [ -f "$LOGFILE" ] ; then
|
if [ -f "$LOGFILE" ] ; then
|
||||||
# Archiving logfile i.e. brew.log is removed (will be created on next run)
|
# Archiving logfile i.e. brew.log is removed (will be created on next run)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue