Page 1 of 1

pdfgrep - Execute command result as Private data

Posted: Fri Aug 09, 2024 3:14 pm
by PrepressNinja
Howdy, I've had no luck after ~6 hours of playing with this and would greatly appreciate guidance.
How can I capture the text result of grep into Private data?

Working terminal code which gives a text file with the grep match:

Code: Select all

pdfgrep  -P 'T\d+' TEST.pdf | tee output.txt
I need to assign the stdout to private data, although I couldn't even get a "sidecar" asset to generate with this:

Code: Select all

pdfgrep  -P 'T\d+' '%1' > '%2\[Job.NameProper].txt'
I have 'Command or path' set to /opt/homebrew/bin/pdfgrep
'Output' Updated input job (also tried to see a text file alongside with 'result next to input')
'Exit code' Discard
'Stdout' Attach as dataset
'Stderr' Discard
Disregard exit codes

My bash knowledge is poor and the syntax required for 'Execute command' is occult to me as well! Thanks so much for reading.

Re: pdfgrep - Execute command result as Private data

Posted: Mon Aug 12, 2024 8:26 am
by Padawan
Execute command can save the stdout to a dataset, but not to private data. It also does not use a shell, so piping and redirecting doesn't work without an intermediate shell file.

If you use the free app Run command, then you can save to private data and you can use redirecting and piping. That will most likely be the easiest solution to your problem.
https://www.enfocus.com/en/appstore/product/run-command

The command syntax is slightly different, you will have to check the documentation to set it up. However should not take 6 hours at all.

Re: pdfgrep - Execute command result as Private data

Posted: Mon Aug 12, 2024 7:31 pm
by PrepressNinja
Hey Padawan. Thank you so much for this suggestion, it works perfectly for this project!

To pay it forward, here is the working setup (note I needed to use the full path to pdfgrep due to 'zsh command not found' errors):

Code: Select all

Shell: Zsh
Command: /opt/homebrew/bin/pdfgrep -P 'T\d+' '%%InputFilePath%%'
Std Out Private Data: StandardOutput
Returns the grep match as private data!