pr - A printf-like command for formatted printing
EXAMPLES:
pr "%g\t%g %s\n" .rms1 .fwhm1 $ Print a line with rms1, fwhm1, and
global string 0 on it.
pr "The rms of scan %g is %g" .ndat .rms1 gs:1;pl mlb: $1
Put 'The rms of scan xxx is yyy.yy' in
global string 1. Use this string as
the title of a plot.
dv s:"junk";pr "hello world" v:"junk" Put "hello world" in the user-defined
variable "junk."
pr "\a" Sound the bell.
DESCRIPTION:
Pr is a command which interfaces directly to the C library function printf
(see "man printf"). Its output can be redirected to any string variable.
The only conversion characters which will work are:
s, e, f, and g
since only doubles and longs can be generated by the parser.
Up to 10 values may be printed in one call.
SPECIAL CHARACTERS:
Following the convention of "The C Programming Language", 2nd Edition
by Kernighan and Ritchie (see appendix A2.5.2), pr recognizes the following
escape sequences:
NAME ASCII ESC. SEQ.
newline NL (LF) \n
horizontal tab HT \t
vertical tab VT \v
backspace BS \b
carriage return CR \r
formfeed FF \f
audible alert BEL \a
backslash \ \\
question mark ? \?
single quote ' \'
double quote " \"
octal number ooo \ooo
hex number hh \xhh
where "ooo" is an octal number consisting of 1, 2, or 3 digits which specify
the value of the desired character. Similarly, "hh" are hexadecimal digits.
The exception is that printing a backslash at the end of a line, e.g.,
-> pr "This is a backslash \\"
confuses the parser. If you really want a \ at the end of a line, use
the hexadecimal or octal code:
-> pr "This is a backslash \x5c"
or
-> pr "This is a backslash \134"
This document was last updated on
Tue Oct 17 16:24:05 EDT 2000
by Marc W. Pound.