[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: find -exec



Ulisses Alonso wrote:
  >
  >Hi all
  >
  >I would like to know if there is a way to make something like this
  >
  >find <some path> -exec command1 {} | command2 \; 
 
I take it you want to run the pipeline `command1 | command2' on each file.

I don't think you can do this with find's own command line; the easiest way
is probably to write a little script and execute that instead:

myscript:
========
#! /bin/bash
if [ -z "$1" ]
then
	echo No parameter
	exit 1
fi
command1 $1 | command2



chmod a+x myscript



find <some path> -exec myscript {} \;
-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
               PGP key from public servers; key ID 32B8FAA1
                 ========================================
     "He that hath my commandments, and keepeth them, he it 
      is that loveth me; and he that loveth me shall be 
      loved of my Father, and I will love him, and will 
      manifest myself to him."      John 14:21 



--  
Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null


Reply to: