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


Formatting files for online browsing or printing

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

Using the shell: You can use shell commands to format a file for browsing or printing, and then later use the lp command to send the formatted file to a printer.

If you want to format and print a file immediately, you can request this printing as a single piped command.

To format a z/OS UNIX file, use the pr command; for example:
pr -2 report1
This command requests the shell to format for printing in two columns a file named report1, and send the output to standard output (your workstation screen). The file appears on your screen in the format you selected. There are many format options for the pr command; see the pr command description in z/OS UNIX System Services Command Reference.
If, instead, you redirect standard output to a file named report2, you can later print the file by entering:
lp report2
This requests the printing of the formatted file in report2; because the dest option is not specified, the file is sent to the default printer destination.
If you want to format a file and print it right away, you can join the requests using a pipe. (See Using a pipe for more information on using a pipe.) For example:
pr -2 report1 | lp
formats and prints the file report1.
To save the formatted output as well as print it, try:
pr  -2 report1 | tee report2 | lp
This command formats report1 and pipes the formatted output to tee. tee writes the formatted output to report2 and at the same time pipes report2 to the next command, lp, which sends the input to the printer queue. The formatted output is saved in report2.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014