tac
is easier to understand in the case it's primarily designed for, which is when the separator is a record terminator, i.e. the separator appears after the last record. It prints the records (including each terminator) in reverse order.
$ echo -n fooabara | tac -s a; echo
rabafooa
The input consists of three records (foo
, b
and r
), each followed by the separator a
; the output consists of three records (r
, b
and foo
), each followed by the separator a
.
If the last record doesn't end with a record terminator, it's still printed first, with no record separator.
$ echo -n fooabar | tac -s a; echo
rbafooa
The last record r
ends up concatenated with the next-to-last record b
with no separator in between, since there was no separator at the end of the last record.
Your input looks a bit more confusing because of the newlines. Let's see it with commas instead of newlines:
$ echo -n a,b,c,b,a, | tac -s a; echo
,,b,c,b,aa
There are three input records: an empty one (with a terminator a
), the bulky one ,,b,c,b,
(again with a terminator), and an unterminated ,
at the end. These records (each with their terminator, except for the last record which doesn't have a terminator) are printed in reverse order.
Your confusion probably comes from expecting the “separator” to be a separator — but that's a misnomer: it's really a record terminator. --before
makes it an initiator instead.
- 1 month
will subtract one from the month number, and then if the resulting date is not valid (February 30
, for example), adjust it so that it is valid. So December 31 - 1 month
is December 1
, not a day in November, and March 31 - 1 month
is March 3
(unless executed in a leap year).
Here's quote from the info page for Gnu date
(which is the date
version which implements this syntax), which includes a good suggestion to make the arithmetic more robust:
The fuzz in units can cause problems with relative items. For
example, 2003-07-31 -1 month
might evaluate to 2003-07-01, because
2003-06-31 is an invalid date. To determine the previous month more
reliably, you can ask for the month before the 15th of the current
month. For example:
$ date -R
Thu, 31 Jul 2003 13:02:39 -0700
$ date --date='-1 month' +'Last month was %B?'
Last month was July?
$ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!'
Last month was June!
Another warning, also quoted from the info page:
Also, take care when manipulating dates around clock changes such as
daylight saving leaps. In a few cases these have added or subtracted
as much as 24 hours from the clock, so it is often wise to adopt
universal time by setting the TZ
environment variable to UTC0
before embarking on calendrical calculations.
Best Answer
The first number (1207841280) is the number of bytes copied so far. The second number is this interpreted as the SI unit Gigabytes (1 GB is 10003 bytes). The third number is this interpreted as the IEC unit Gibibytes (1 GiB is 10243 bytes). Notice the difference between "GB" and "GiB".
The source code of the
dd
command in the GNU coreutils package uses variables calledsi
andiec
to hold the last two of these numbers. See theprint_xfer_stats
function indd.c
. The actual output happens on line 821.