There are three other functions of sed not discussed in
the sections above.
The = function writes the number of the line matched by
its address to the standard output. One address is possible.
The length of a file can be found using the following command:
This command is not counting the lines, but rather showing the
length of the file by printing the number of the last line.
The list function is used to display the contents of the pattern
space. Non-printable characters such as BEL (\a) are
displayed as two digit ASCII codes.
The q function causes the current line to be written to
the output (if it should be), any appended or read text to be written,
and execution to be terminated. One address is possible. This function
could be used to shorten processing if, for example, the objective
was to truncate a very long file at the first occurrence of a given
word, by copying the input to the output then quitting as soon as the
word was encountered.
Comments in sed
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005