[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



heh...yes, I think you do have a bit too much time on your hands ;-)...
Was hoping there was some shell syntatic sugar or cmdline tool, but I
suppose perl is always there to fill that gap.  Thanks!

John


Fletch said:
>
> Or even this . . .
>
> (yes, I got bored and I'm re-learning ruby)
>
> #!/usr/bin/ruby
>
> unless ARGV.size == 1
>   $stderr.puts "usage: #{$0} pattern"
>   exit 1
> end
>
> pattern = %r(#{ARGV[0]});
>
> IO.popen( "locate .txt" ) do |locate|
>   locate.readlines.grep(/\.txt$/).map { |n| n.chomp! }.each do |fname|
>     begin
>       File.open( fname, "r" ) do |cur|
>         cur.each { |l| puts "#{fname}: #{l}" if l =~ pattern }
>       end
>     rescue IOError
>       puts "problem opening #{fname}: #{$!}"
>       next
>     end
>   end
> end
>
> __END__
>
> --
> Fletch                | "If you find my answers frightening,       __`'/|
> fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
>                       |  scary questions." -- Jules                =(___)=
>                       |                                               U
> _______________________________________________
> Ale mailing list
> Ale at ale.org
&gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>
&gt;


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00778" href="msg00778.html">[ale] dreaded spaces in file names....</a></strong>
<ul><li><em>From:</em> jb at devsea.com (John Wells)</li></ul></li>
<li><strong><a name="00780" href="msg00780.html">[ale] dreaded spaces in file names....</a></strong>
<ul><li><em>From:</em> fletch at phydeaux.org (Fletch)</li></ul></li>
<li><strong><a name="00781" href="msg00781.html">[ale] dreaded spaces in file names....</a></strong>
<ul><li><em>From:</em> fletch at phydeaux.org (Fletch)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00788.html">[ale] X servers other than Xfree</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00790.html">[ale] &quot;Ghosting&quot; a Windows Machine Using Linux CD</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00781.html">[ale] dreaded spaces in file names....</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00794.html">[ale] dreaded spaces in file names....</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00789"><strong>Date</strong></a></li>
<li><a href="threads.html#00789"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>