gemini-capsule

My gemini capsule
git clone git://jb55.com/gemini-capsule
Log | Files | Refs

commit 3425d7e4135163b30650a497f39b73c9e4402e1a
parent 35223fed5dfeb8f140ed405a67e20528f2362d8e
Author: William Casarin <jb55@jb55.com>
Date:   Sun,  5 Dec 2021 22:29:22 -0800

update datefmt example

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mprojects/datefmt.gmi | 16+++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/projects/datefmt.gmi b/projects/datefmt.gmi @@ -3,11 +3,13 @@ datefmt is a simple C program that formats unix timestamps in text streams -## Example +## Examples Let's say we have some logs that contain unix timestamps: ``` +$ cat logs.txt + EVENTS 1638499687 blahblah log1 EVENTS 1638499717 blahblah log2 ``` @@ -15,10 +17,22 @@ EVENTS 1638499717 blahblah log2 We can pipe this log into datefmt to convert these timestamps into human-readable dates: ``` +$ <logs.txt datefmt + EVENTS 2021-12-02 18:48 blahblah log1 EVENTS 2021-12-02 18:48 blahblah log2 ``` +Of course you can customize the format as well: + +``` +$ <logs.txt datefmt "DATE:'%m-%d %R'" + +EVENTS DATE:'12-02 18:48' blahblah log1 +EVENTS DATE:'12-02 18:48' blahblah log2 +``` + + It's as simple as that! It comes with some heuristics so that it doesn't parse timestamp outside of a reasonable range. ## Download