(Mar-28-2021, 05:13 PM)perfringo Wrote: Now when the code is sorted out we can focus on algorithm
Is there particular reason why to drop out from shell and go through all this resource consuming write-read-delete file process? Why not just use the power of shell and let it do all the work? Something like this should deliver count of matches:
dmesg -T | grep -o -i bluetooth | wc -l
Flags used:
-o: output each match on separate output line
-i: ignore case
-l: count lines
Why there is need to use -T flag (timestamp) if it is not used anywhere?
Many roads lead to Rome. Thank you!
The idea behind this is to count the Under-voltage messages and send the total and it's registered time to an email once a day.
where's that info? This' what I get:
Usage:
dmesg [options]
Display or control the kernel ring buffer.
Options:
-C, --clear clear the kernel ring buffer
-c, --read-clear read and clear all messages
-D, --console-off disable printing messages to console
-E, --console-on enable printing messages to console
-F, --file <file> use the file instead of the kernel log buffer
-f, --facility <list> restrict output to defined facilities
-H, --human human readable output
-k, --kernel display kernel messages
-L, --color[=<when>] colorize messages (auto, always or never)
colors are enabled by default
-l, --level <list> restrict output to defined levels
-n, --console-level <level> set level of messages printed to console
-P, --nopager do not pipe output into a pager
-p, --force-prefix force timestamp output on each line of multi-line messages
-r, --raw print the raw message buffer
-S, --syslog force to use syslog(2) rather than /dev/kmsg
-s, --buffer-size <size> buffer size to query the kernel ring buffer
-u, --userspace display userspace messages
-w, --follow wait for new messages
-x, --decode decode facility and level to readable string
-d, --show-delta show time delta between printed messages
-e, --reltime show local time and time delta in readable format
-T, --ctime show human-readable timestamp (may be inaccurate!)
-t, --notime don't show any timestamp with messages
--time-format <format> show timestamp using the given format:
[delta|reltime|ctime|notime|iso]
Suspending/resume will make ctime and iso timestamps inaccurate.
-h, --help display this help
-V, --version display version