Oscar Lok wrote:

> Hi, everybody
> 
> This is my first time get into this forum.
> I would like to know that is it a forum for us to discuss about
> everythings in Ruby, please?
> If so,
> 1)I would like to know that how can I delete or remove a line in a text
> file, please?
> 2)How can I read some letter in a line, please?
> e.g. a text file like this:-
> 
> aabbcc
> ddeeff
> gghhii
> jjkkll
> 
> 1)I want to delete ddeeff become like this:-
> aabbcc
> gghhii
> jjkkll

--------------------------------------------------

#!/usr/bin/ruby

data=<<EOF
aabbcc
ddeeff
gghhii
jjkkll
EOF

puts "Before:",data

data.sub!(/ddeeff\n/,"")

puts "\nAfter:",data

--------------------------------------------------

Output:

Before:
aabbcc
ddeeff
gghhii
jjkkll

After:
aabbcc
gghhii
jjkkll


> 
> 2)I get the result like :-
> hh

Please explain the circumstances under which you want to get this result.

-- 
Paul Lutus
http://www.arachnoid.com