Monday, August 4, 2008

Printing Part of IFS File:

There are two Qshell commands. Sed, the stream editor, can select the lines we want to print. The Rfile utility can send them to a printer.


If we know the line numbers, we can use a command like this one:

sed -n '93,96p' myfile.txt | rfile -wQ qsys/qsysprt

This command prints lines 93 through 96 of file myfile.txt.

If we want the system to select the lines based on the contents of the file, then:

sed -n '/WORLD/,/AMERICAN/p' myfile.txt | rfile -wQ sys/qsysprt

This example starts printing when it finds the string WORLD and stops printing after it finds a line with the string AMERICAN.

Here's another example that mixes the two record-selection methods:

sed -n '/WORLD/,104p' myfile.txt | rfile -wQ qsys/qsysprt

The system starts printing when it finds a line that contains WORLD, and stops printing after line 104.

The Rfile utility allows Qshell to work with record-oriented files.

No comments: