On 19/09/2023 07:10, Keith Thompson wrote:
[Sed:]
> The 'c' command is a GNU extension.
The "c" /command/ was "original", and is in 7th Edition Unix.
But originally it had to be followed /immediately/ by a backslash,
with the replacement text on the following line(s). On my current
[Linux] machine, "man sed" shows optional space(s) between "c" and
the backslash [which is presumably the GNU extension, as it's an
obvious change to make on a re-write]. But it doesn't show the extra
[also obvious] possibility of the replacement text on the same line,
for which, as you suggest, you need "info sed".
Personally, I prefer "man" to "info", if available, as the
output is formatted nicely, so it's understandable that the extra
extension should be overlooked. OTOH, once spaces are allowed, it's
harder to exclude the same-line extensions to "a", "c" and "i" than
to allow them, so perhaps the documentation should emphasise the
same-line version and then point out the usefulness of backslashes.
[To Zhao:]
> (Seriously, I wonder why checking the documentation wasn't your first
> thought before posting here.)
Perhaps he enjoys getting a rise out of people who wonder why
he prefers asking here to checking elsewhere? It's not as though this
is the first example of its type over the past decade and more.
--
Andy Walker, Nottingham.
Andy's music pages:
www.cuboid.me.uk/andy/Music
Composer of the day:
www.cuboid.me.uk/andy/Music/Composers/Praetorius