[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Should it be mentioned that 0~n syntax accepts 0 address as well?
From: |
Arkadiusz Drabczyk |
Subject: |
Should it be mentioned that 0~n syntax accepts 0 address as well? |
Date: |
Sun, 9 Feb 2025 16:52:55 +0100 |
In the manual it says how to use ~ to specify an address from the 0th
line:
> Thus, one would use 1~2 to select the odd-numbered lines and 0~2 for
> even-numbered lines;
> (...)
> $ seq 10 | sed -n '0~4p'
> 4
> 8
But later in the manual it says:
> 4.5 Zero Address
>
> As a GNU sed extension, 0 address can be used in two cases:
>
> 1. In a regex range addresses as 0,/regexp/ (see [Zero Address Regex
> Range], page 25).
>
> 2. With the r command, inserting a file before the first line (see
> Section 7.9 [Adding a header to multiple files], page 53).
>
> Note that these are the only places where the 0 address makes sense;
> Commands which are given the 0 address in any other way will give an
> error.
Shouldn't 0~n syntax be mentioned here as well?
--
Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
- Should it be mentioned that 0~n syntax accepts 0 address as well?,
Arkadiusz Drabczyk <=