[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: date does not support pipes
From: |
Marc Chantreux |
Subject: |
Re: date does not support pipes |
Date: |
Sat, 13 Jan 2024 11:58:15 +0100 |
On Sat, Jan 13, 2024 at 11:08:52AM +0100, Philip Rogers wrote:
> Thanks for the reply.
you're welcome.
> 1. Other utils do not require `-` to be specified, do they? For example, the
> manpage for sed says:
> > if no input files are specified, then the standard input is read.
because sed is a filter so it is expected to consume a stream which is
stdin by default.
On the other hand, date is a "generator" with no need to read from
stdin for its default behavior.
-f is the way to transform date into a generator
- means "the relavant stdio", stdin in this case.
> 2. In any case, I think it should be documented to pass `-` to read from
> stdin
from date (1) - print or set the system date and time
-f, --file=DATEFILE
like --date; once for each line of DATEFILE
the - thing is a convention in unix. should it be documented in all the
filter man pages?
> 3. The command `stat --format "%Y" check.txt | date -f-` does not work. It
> returns:
>
> > date: invalid date ‘1705140089’
oh … you're right. maybe it's worth a patch? btw this work:
stat --format "%y" /etc/hostname | date -f-
> 4. On a related note, the man page I think should also document the use of
> `@` for seconds since the epoch.
this is in the examples section.
> Thanks again and best regards,
coreutils team will probably argue that it is documented in the section 29.9
of the info documentation.
info date --index-search=Epoch
regards
marc