1.

Solve : how to find files across multiple directories, like $PATH?

Answer»

Hello all,

I am TRYING to find all the commands in my $PATH that process pdf files. So I TRIED this:

$ echo $PATH
/usr/bin/override:/usr/sys:/usr/bin:/bin
$ echo $PATH | sed 's/:/ /g' | xargs -L 1 -i find {} -name "*pdf*" -ls

and got the error:

find: cannot open /usr/bin/override /usr/sys /usr/bin /bin : No such file or directory

I don't quite get what I am doing wrong. I am expecting xargs to parse 1 arg at a TIME from the sed command, each arg being blank-delimited (as per man xargs page).

I know there is a file /usr/bin/opdfupld - not what I am looking for, but at least the name matches - why can't it be FOUND?

Does anyone have a better suggestion, or an idea what I am doing wrong? Thanks! Dave
Quote from: dawerbuch on DECEMBER 17, 2007, 12:27:10 PM

Hello all,

I am trying to find all the commands in my $PATH that process pdf files. So I tried this:

$ echo $PATH
/usr/bin/override:/usr/sys:/usr/bin:/bin
$ echo $PATH | sed 's/:/ /g' | xargs -L 1 -i find {} -name "*pdf*" -ls

and got the error:

find: cannot open /usr/bin/override /usr/sys /usr/bin /bin : No such file or directory

I don't quite get what I am doing wrong. I am expecting xargs to parse 1 arg at a time from the sed command, each arg being blank-delimited (as per man xargs page).

I know there is a file /usr/bin/opdfupld - not what I am looking for, but at least the name matches - why can't it be found?

Does anyone have a better suggestion, or an idea what I am doing wrong? Thanks! Dave

if you want to find the commands that process pdf files, you can use
man -k pdf


Discussion

No Comment Found