Command Reference Guide

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
b
bfs(1) bfs(1)
xv[digit][spaces][value]
The variable name is the specified 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 first 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 file 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 first line of output from an
HP-UX com-
mand can be stored into a variable. The only requirement is that the first character of
value be an
!. For example:
.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 first 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 HP-UX
system
command (
!command) for a zero or non-zero value, respectively, and cause a branch to the
specified label. The two examples below both search for the next five lines containing the
string size.
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]Ifswitch 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
HP-UX Release 11i: December 2000 − 2 − Section 1−−47
___
___