z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Determining line numbers

z/OS UNIX System Services User's Guide
SA23-2279-00

In these instructions, we made use of line numbers to refer to lines. How do you know what number a line has? If you just want to know the number of one line, move the cursor to that line and type
:.=
For another approach, type:
:set number
and press <Enter>. As you can see, this displays the number of every line in the file. If you want to turn off the display of line numbers, type:
:set nonumber
A number of special symbols can be used when specifying a range of lines. The . (period) stands for the line where the cursor is currently positioned. For example, move the cursor to this line and type:
:1,.s/$/???/
This adds ??? to the end of every line from the start of the file to the line containing the cursor.
When you issue a substitute command with a range, it is all right if some of the lines in the range do not contain the pattern you are replacing. When specifying a range of lines, $ stands for the last line in the file. For example, the command:
:1,$s/the/THE/g
changes every the in the file to uppercase (including words like there, where the is part of another word).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014