#!/usr/local/rexx/rxx /* * MULT * * The MULT filter program takes piped input and outputs all lines * containing the string(s) passed as arguments to the program. * * The program may be executed by typing something similar to the * following examples. * * cat | mult * * where is the file to be searched and is the * string(s) to be located. Results of running the MULT program are * directed to standard output (the terminal screen). * * cat | mult > out.file * * Same as the above example, except results of MULT program are * redirected to the file named 'out.file'. * * cat READ.ME | mult filter to * * Displays all lines of the READ.ME file containing the words * 'filter' and 'to' on the same line. * * ls -l | mult rlp * * Displays the directory listing for the file named 'rlp'. * * */ parse arg strings /* all words to be searched for */ do while lines()>0 /* process entire file */ line=linein() /* line is a candidate to be tested */ do x=1 /* x= only for leave instruction below */ do i=1 to words(strings) /* try all words in string */ if wordpos(word(strings,i),line)=0 /* 0 means not found */ then leave x /* terminates outer loop */ end i /* end of all tests */ call lineout(,line) /* if all found, write it out */ leave x /* terminate loop */ end x end call lineout() /* close output file */ exit