Date: Fri, 25 Aug 2006 10:03:27 -0400 From: John Baldwin <jhb@freebsd.org> To: freebsd-current@freebsd.org Cc: Oliver Fromme <olli@lurza.secnetix.de>, julian@elischer.org Subject: Re: suggested addition to 'date' Message-ID: <200608251003.28528.jhb@freebsd.org> In-Reply-To: <200608181445.k7IEjA9f020038@lurza.secnetix.de> References: <200608181445.k7IEjA9f020038@lurza.secnetix.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 18 August 2006 10:45, Oliver Fromme wrote: > Julian Elischer wrote: > > BTW I chose 's' without any research.. Date only has the short getopt so > > '--' doesn't work, but > > there are lots of unsed letters.. a quick survey suggests maybe -p (pipe?) > > (suggestions welcome) my favourites of s and f are already used on one > > system or another. > > There's another possibility, which doesn't require a new > option letter at all. You could add a new escape sequence > to the format string, e.g. "%*". Whenever date(1) is > called with a format string containing that sequence, it > goes into filter mode and replaces the sequence with the > current line. That would also enable you to be more > flexible with the placement of the timestamps. > For example: > > $ printf 'foo\nbar\nbaz\n' | date +'%H:%M:%S %*' > 16:39:58 foo > 16:39:58 bar > 16:39:58 baz I prefer this of all the suggestions so far. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608251003.28528.jhb>