[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Mon Jan 19 22:51:39 2004 -->
- <!--x-from-r13: syrgpu ng culqrnhk.bet (Tyrgpu) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: [email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] dreaded spaces in file names.... -->
- <li><em>date</em>: Mon Jan 19 22:51:39 2004</li>
- <li><em>from</em>: fletch at phydeaux.org (Fletch)</li>
- <li><em>in-reply-to</em>: <<a href="msg00780.html">[email protected]</a>> ([email protected]'s message of "Mon, 19 Jan 2004 22:20:22 -0500")</li>
- <li><em>references</em>: <<a href="msg00778.html">[email protected]</a>> <<a href="msg00780.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] dreaded spaces in file names....</li>
(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
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00789" href="msg00789.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="00794" href="msg00794.html">[ale] dreaded spaces in file names....</a></strong>
<ul><li><em>From:</em> dhurst at kennesaw.edu (Dow Hurst)</li></ul></li>
</ul></li></ul>
<!--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>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00785.html">[ale] "Ghosting" a Windows Machine Using Linux CD</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00782.html">[ale] "Ghosting" a Windows Machine Using Linux CD</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00780.html">[ale] dreaded spaces in file names....</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00789.html">[ale] dreaded spaces in file names....</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00781"><strong>Date</strong></a></li>
<li><a href="threads.html#00781"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>