Re: Is it fair to say, "sed supports # comments starting any column"?

"Daniel Goldman [email protected] [sed-users]" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Thanks. I didn't see where the POSIX spec talked about ; syntax. It 
seems it should, because ; seems very useful. Just didn't see it. And of 
course my post was not about ; syntax, that's a different issue.

Consistent with what you said, POSIX says, "The treatment of '#' 
comments differs from the SVID which only allows a comment as the first 
line of the script, but matches BSD-derived implementations. The comment 
character is treated as a command, and it has the same properties in 
terms of being accepted with leading <blank> characters; the BSD 
implementation has historically supported this.". But it also says for # 
definition, "Ignore the '#' and the remainder of the line". In other 
words, the standard is to allow comments starting any column.

My questions #1 and #2 are at least partially answered, so that's a 
little progress. But if this is it, that's disappointing. Anybody else?

On 8/11/2015 1:35 AM, [email protected] [sed-users] wrote:
> Hi Daniel,
>
>   The POSIX spec does talk about the <semicolon> syntax, although it's not enforced.
>
>
>   The System V "sed" has this restriction that only the 1st line can be a
>   comment line, and then only if the first char. is #. (with #n as exception)
>
>
>   As to why some SEDs are not POSIX compliant in terms of the comment char I am not sure. Many times, things are a relic of the past when memory was at a premium & the sed versions may never have gotten upgraded.
>
>
>   Thanks,
>   Rakesh
>
>
> ---In [email protected], <dgoldman@...> wrote :
>
>   Hi Rakesh,
>
>   I know you are trying to help. But you didn't answer any of my
>   questions. :( I am not a newbie trying to learn sed. I have specific
>   questions I am looking for experts such as yourself to weigh in on.
>
>   You are probably aware that some sed versions do not support ; syntax.
>   Plus, the POSIX standard does not mention ; syntax. So offering ; as a
>   solution doesn't help anyway.
>
>   Personally, I think it is fair to say, "sed supports # comments starting
>   any column", since that is what POSIX says. I am looking for someone to
>   explain why that is not true.
>
>   Thanks,
>   Daniel
>
>   On 8/11/2015 12:23 AM, Rakesh Sharma [sed-users] wrote:
>   > 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
>   >
>   > ________________________________
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
> Posted by: [email protected]
> ------------------------------------
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.