Now.sh
Pipeable bash script that prints current time while waiting for an input from stdin
Install / Use
/learn @apankrat/Now.shREADME
now.sh
A simple shell script that prints current date/time while waiting for an input and echoing it to the stdout.
It is particularly useful with tail
when following log files. Instead of -
tail -F access.log | grep "GET / "
yielding -
173.199.116.xx - - [03/Mar/2013 01:05:18 -0800] "GET / HTTP/1.1" 200 2249 ...
59.167.170.xx - - [03/Mar/2013 01:10:19 -0800] "GET / HTTP/1.1" 200 2307 ...
54.251.76.xx - - [03/Mar/2013 01:16:52 -0800] "GET / HTTP/1.1" 200 2223 ...
use -
tail -F access.log | grep "GET / " | now
and get -
173.199.116.xx - - [03/Mar/2013 01:05:18 -0800] "GET / HTTP/1.1" 200 2249 ...
59.167.170.xx - - [03/Mar/2013 01:10:19 -0800] "GET / HTTP/1.1" 200 2307 ...
54.251.76.xx - - [03/Mar/2013 01:16:52 -0800] "GET / HTTP/1.1" 200 2223 ...
Mar 3 01:20:59 PST 2013
where the last line is reprinted every second with current time.
This gives an idea of when the last log activity was without needing to remember what the server time zone is or what the "-0800" translates to in your local time.
Timestamp format
The timestamp format can be adjusted by passing the
date
format string to now. For example, this tweak -
tail -F access.log | grep "GET / " | now "[%d/%b/%Y %H:%M:%S %z]"
yields -
173.199.116.xx - - [03/Mar/2013 01:05:18 -0800] "GET / HTTP/1.1" 200 2249 ...
59.167.170.xx - - [03/Mar/2013 01:10:19 -0800] "GET / HTTP/1.1" 200 2307 ...
54.251.76.xx - - [03/Mar/2013 01:16:52 -0800] "GET / HTTP/1.1" 200 2223 ...
[03/Mar/2013 01:20:59 -0800]
Related Skills
node-connect
336.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
336.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.9kCommit, push, and open a PR
