D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] GNU parallel

 

On 20 May, 2012, at 3:49 pm, Simon Waters wrote:

On 20/05/12 14:28, Philip Hudson wrote:
Just became aware of this last week, installed it and got a few basic
scripts working with it instead of xargs. But I *cannot* work out how to get it to pipe. I have RTFMed til I'm sick of the sight of the page and
I've googled every which way. Anyone got a clue?
Tell us what you are trying to do, how you try to do it, and what the
result is.

I just downloaded parallel-20120422, unpacked, configure, make, cd src, and
find . -name "*.html" | ./parallel tidy | less

Does pretty much what I would expect.

http://catb.org/~esr/faqs/smart-questions.html
Trying to filter filenames using grep. To extend your example (which I  
don't believe can have worked correctly as transcribed, BTW, except  
accidentally):
find . -name '*.html' | parallel --WTF-works-here-to-pipe-into grep -- 
only-matching '<regexp>'
Where I want to run grep on each filename itself, not the contents of  
the named file; in other words, I want parallel to pipe each filename  
into grep on stdin, not pass it as a (filename) parameter to an  
invocation of grep.
Your example uses parallel to pass a different parameter to each  
invocation of tidy and only then to pipe anything further. I want  
parallel to pipe a different stream (happening to be a filename) into  
each invocation of grep on stdin.
Hope that's clear, and thanks for answering.

--
Phil Hudson                  http://hudson-it.no-ip.biz
@UWascalWabbit                 PGP/GnuPG ID: 0x887DCA63


--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq