bfs(1) | bfs(1) |
xv[digit] [spaces] [value]
The variable name is the speci®ed digit following the xv. xv5100 or xv5 100 both assign the value 100 to the variable 5. Xv61,100p assigns the value 1,100p to the variable 6. To reference a variable, put a % in front of the variable name. For example, using the above assignments for variables 5 and 6:
1,%5p
1,%5
%6
all print the ®rst 100 lines.
g/%5/p
globally searches for the characters 100 and prints each line containing a match. To escape the special meaning of %, a \ must precede it. For example, to match and list lines in a program ®le that contain printf() format strings specifying characters, decimal integers, or strings, the following could be used:
g/".*\%[cds]/p
Another feature of the xv command is that the ®rst line of output from an
.w junk xv5!cat junk !rm junk !echo "%5" xv6!expr %6 + 1
each put the current line into variable 5, print it, and increment the variable 6 by one. To escape the special meaning of ! as the ®rst character of value, precede it with a \.
xv7\!date
stores the value !date into variable 7.
xbz label
xbn label These two commands test the last saved return code from the execution of an
First example: |
|
|
xv55 |
|
|
: l |
|
|
/size/ |
|
|
xv5!expr | %5 - 1 |
|
!if [ %5 != 0 ] ; then exit 2 ; fi |
| |
xbn l |
|
|
Second Example: |
|
|
xv45 |
|
|
: l |
|
|
/size/ |
|
|
xv4!expr | %4 - 1 |
|
!if [ %4 = 0 ] ; then exit 2 ; fi |
| |
xbz l |
|
|
xc [ switch ] If switch is 1, output from the p and null commands is crunched; if switch is | 0 it isn't. | |
Without an argument, xc reverses switch. Initially switch is set for no | crunching. |
Crunched output has strings of tabs and blanks reduced to one blank, and blank lines suppressed.
EXTERNAL INFLUENCES
b
− 2 − | Section 1−47 |