[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] script help please
From: |
Pierre Gaston |
Subject: |
Re: [Help-bash] script help please |
Date: |
Thu, 25 Jun 2015 18:35:47 +0300 |
On Thu, Jun 25, 2015 at 5:38 PM, Randy <address@hidden> wrote:
> I'm sorry this will seem like a simple question - but I've already
> asked my more bash-literate friends. We're stuck.
> There is a command I use frequently:
> find *.pdf -exec sh -c 'pdftotext "{}" - | grep --with-filename
> --label="{}" --color "XXXX"' \;
> (where "XXXX" is the text for which I am search PDF files.)
> I tried to write a script, where I could simply pass-in ($1) the
> string. Could not make it work.
> I would greatly appreciate help with this syntax.
> Thank you,
> Randy
>
pass it and the filename as arguments to sh:
find *.pdf -exec sh -c 'pdftotext "$2" - | grep --with-filename
--label="$2" --color -- "$1"' _ "$1" {} \;