An octothorpe (#) must be the first character on the line. The syntax of a comment line is:
#[n]
The following example shows the first line of a script:
# wstar.sed: convert WordStar files
If necessary, the comment can be continued on multiple lines by ending the preceding line with a backslash.[28] For consistency, you might begin the continuation line with an # so that the line's purpose is obvious.
[28]This does not work with GNU sed (version 2.05), though.
If the next character following # is n, the script will not automatically produce output. It is equivalent to specifying the command-line option -n. The rest of the line following the n is treated as a comment. Under the POSIX standard, #n used this way must be the first two characters in the file.
Copyright © 2003 O'Reilly & Associates. All rights reserved.