in reply to Search for a string in a file
word = ARGV.shift File.open( ARGV.shift, 'r' ) do |in| File.open( ARGV.shift, 'w' ) do |out| in.each do |line| if line.chomp! == word out.puts line end end end end
Just do that in Perl and Bob's your paternal male sibling.
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search for a string in a file
by bv (Friar) on Mar 01, 2010 at 19:57 UTC | |
by Fletch (Bishop) on Mar 02, 2010 at 13:38 UTC | |
by bv (Friar) on Mar 02, 2010 at 14:52 UTC |