DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Manipulating text with sed

Miscellaneous functions

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.


l
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.

q
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.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004