[net.unix] pipes within a 'find' command

quan@hplabsc.UUCP (Suu Quan) (09/26/86)

This command did not work :
find /usr/spool/eroff -print -exec tbl {} | eqn | eroff -ms \; -exec rm {} \;
                                   ^^^^^^^^^^^^^^^^^^^^^^^^
     The underlined pipe is to properly print a file.

Intention : scan all the files in directory /usr/spool/eroff
            print the file
            remove the file.

Problem : as is, the command does not work.
	I tried using "" quotes, I tried using escape character \, I tried
		using parentheses (), I tried a combination of them.
	Nothing works.

I finally resigned to do this :

find /usr/spool/eroff -print -exec shell_script {} \;

with the contents of the file 'shell_script' to be

	tbl $1 | eqm | eroff -ms; rm $1

Can somebody out there teach me how to use a pipe within a find
command. I hate to maintain another shell script.

			Suu Quan phone (415) 857-3594
			quan%hplabs@HPLABS.HP.COM
			!hpda!hplabsc!quan
-- 
Suu Quan phone (415) 857-3594
quan%hplabs@HPLABS.HP.COM
!hpda!hplabsc!quan

itkin@luke.UUCP (Steven M. List) (10/03/86)

In article <686@hplabsc.UUCP> quan@hplabsc.UUCP (Suu Quan) writes:
>This command did not work :
>find /usr/spool/eroff -print -exec tbl {} | eqn | eroff -ms \; -exec rm {} \;
>                                   ^^^^^^^^^^^^^^^^^^^^^^^^
>     The underlined pipe is to properly print a file.
>
>Intention : scan all the files in directory /usr/spool/eroff
>            print the file
>            remove the file.
>
>Problem : as is, the command does not work.

How about my personal favorite: xargs...

	find /usr/spool/eroff -print | tee /tmp/jnk$$ |
		xargs -i@ tbl @ | eqn | eroff -ms ; rm -f `cat /tmp/jnk$$` /tmp/jnk$$

This is at least as fast as your find would have been using exec, and
also provides more flexibility.
-- 
***
*  Steven List @ Benetics Corporation, Mt. View, CA
*  Just part of the stock at "Uncle Bene's Farm"
*  {cdp,engfocus,idi,oliveb,opusys,plx,pyramid,tolerant}!bene!luke!itkin
***