# - Print count register.
Syntax:
#
Description:
# displays the contents of the count register. The count register is
affected by a number of commands.
- After an S command, the count register is set to the number of substitutions
made by the command.
- After a G command, the count register contains the number of lines marked for
processing by the given command.
- After an R, W, or L command, the count register
contains the number of blocks read or written or listed. If an access error occurred in
the I/O operation, the count register will contain the file system error status.
- Whenever a number register is changed by an N command, the count register is
set to the new value of that number register.
To give an example of how # can be used, we can print the number of
characters on a line (excluding the new-line character) with the instruction
s/./&/#
The command
*s/./&/#
prints the number of characters in the entire buffer (excluding the new-lines).
Copyright © 1998, Thinkage Ltd.