Using a pipe with find .... -exec ... | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Using a pipe with find .... -exec ...

UNIX for Advanced & Expert Users


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-29-2008
pmallas pmallas is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 29 January 2008, 4:15 PM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Using a pipe with find .... -exec ...

Hi,

I am trying to run the following command:
find ./ -name lea_01.001 -print -exec CEOS {} | grep -i radio \;

where "CEOS" converts the lea_01.001 files to text, then grep looks for the string "radio." This however does not work as I have constructed it.

This command mostly works, but the grep filters out the full path of the current file being used (from -print). But I need that output too.
find ./ -name lea_01.001 -print -exec CEOS {} \; | grep -i radio

Any clues how to print the full path information and the grep only on the output of CEOS (rather than the output of find?)
Sponsored Links
    #2  
Old 01-29-2008
pmallas pmallas is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 29 January 2008, 4:15 PM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Figured it out

Figured out my own solution:

find ./ -name lea_01.001 -print -exec sh -c 'CEOS $1 | grep -i radio' {} {} \;
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
find: missing argument to `-exec' while redirecting using find in perl ramkumarselvam Shell Programming and Scripting 2 12-16-2011 06:48 PM
difference bewteen pipe, xargs, and exec guessingo Programming 1 10-12-2011 12:28 PM
Newbie question on exec,fork, wait,pipe C Cuervo Programming 1 06-06-2011 11:40 AM
Using MV FIND and -EXEC degraff63 Shell Programming and Scripting 0 05-05-2009 03:54 AM
| with find -exec vijay_0209 Shell Programming and Scripting 3 04-22-2009 05:23 PM



All times are GMT -4. The time now is 01:06 AM.