Re: Is it fair to say, "sed supports # comments starting any column"?
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <CY1PR13MB05810FF1CBBA97CFA5882564B97F0@CY1PR13MB0581.namprd13.prod.outlook.com> |
I normally use the ";#" syntax to start comments. The semicolon would start a newline and the # would then start at the first column, thus satisfying both.
> s/x/y/ # Silly comment 1
s/x/y/ ;# Silly comment 1
________________________________
From: [email protected] <[email protected]> on behalf of [email protected] [sed-users] <[email protected]>
Sent: Monday, August 10, 2015 11:53 PM
To: [email protected]
Subject: Is it fair to say, "sed supports # comments starting any column"?
GNU sed supports comments starting any column. In other words, the following script works:
s/x/y/ # Silly comment 1
s/a/b/ # Silly comment 2
I am told that some sed versions only support comments that start in column 1. I don't doubt it. I suppose those sed versions would crash or otherwise malfunction on the above script. Seems primitive to me. :( And coming from a sed user, calling something primitive is saying something. :)
The POSIX specification does not restrict comments to start in column 1. Thus, POSIX says comments can start in any column. Thus, this difference between GNU and other versions seems not a "GNU extension".
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html
So here are my questions for the experts on the egroup:
1) Which actively maintained sed versions require comments to start in column 1?
2) I have nothing against these other versions. The more versions, the better. But if POSIX says comments can start in any column, why aren't these other versions "fixed up" to be compliant, or even to be adequate? It shouldn't be all that difficult. If they aren't "fixed up", are they really actively maintained?
3) Given POSIX, is it fair to say, "sed supports # comments starting any column"?
4) What other standard overrides POSIX, and justifies other seds not getting "fixed up"?
Thanks,
Daniel
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]