5.9 Print Line NumberAn equal sign (=) following an address prints the line number of the matched line. Unless you suppress the automatic output of lines, both the line number and the line itself will be printed. Its syntax is:
This command cannot operate on a range of lines. A programmer might use this to print certain lines in a source file. For instance, the following script prints the line number followed by the line itself for each line containing a tab followed by the string "if". Here's the script: #n print line number and line with if statement / if/{ = p } Note that #n suppresses the default output of lines. Now let's see how it works on a sample program, random.c : $ The line numbers might be useful in finding problems reported by the compiler, which typically lists the line number. |
|