<p dir="ltr">Change the ruby script. Ruby has a var that defines the name of the current file (ARGF.filename) and you can just do something like,</p>
<p dir="ltr">puts &quot;#{ARGF.filename}:#{output}&quot; if output =~ /pattern/</p>
<p dir="ltr">Jacon</p>
<div class="gmail_quote">On Sep 16, 2012 5:30 PM, &quot;David L. Anselmi&quot; &lt;<a href="mailto:anselmi@anselmi.us">anselmi@anselmi.us</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Sean LeBlanc wrote:<br>
&gt; I have a Ruby script that takes as input either:<br>
&gt;<br>
&gt; 1. 1-N command line args, assumes those are filenames, and iterates over<br>
&gt; those, translating the files into a readable format - writing on STDOUT.<br>
&gt; 2. If no args, read STDIN and do the same with that stream of data.<br>
&gt;<br>
&gt; find . -name * -print | xargs ./myscript.rb | grep &quot;asearchstring&quot;<br>
&gt;<br>
&gt; And that&#39;s all well and good. Now, I want to know what file(s) I get a<br>
&gt; hit in.<br>
<br>
Since you don&#39;t seem to care that all the inputs go to the same output you could prepend each line<br>
with the file name.<br>
<br>
Your script could send each file name to stderr before processing it.  That only really works for<br>
screen output and isn&#39;t the Unix Way.<br>
<br>
Your script could send each file name to stdout before processing it and then your grep could<br>
include something that works on the file name lines:<br>
  ... | egrep &quot;(file:|asearchstring)&quot;<br>
<br>
Your script could produce an output file for each input file and then grep would work as usual (then<br>
to pipe to it you&#39;d write the file names to stdout and go through xargs again).<br>
<br>
HTH,<br>
Dave<br>
_______________________________________________<br>
clue mailing list: <a href="mailto:clue@cluedenver.org">clue@cluedenver.org</a><br>
For information, account preferences, or to unsubscribe see:<br>
<a href="http://cluedenver.org/mailman/listinfo/clue" target="_blank">http://cluedenver.org/mailman/listinfo/clue</a><br>
</blockquote></div>