R
Raveendran Jazzez
Hi All,
My code:
code.rb
lines=File.open("hi.txt","r")
output=[]
lines.each do |single|
out1=single.split(' ')
out2=out1[0].gsub('<B>', '')
out3= out2.gsub('</B>', '')
out4=out3.gsub('<WBR>','')
output << out4 # I need to overwrite the appropriate line.
end
hi.txt:
wordpress.com/tag/<B>jazzez</B>/ - 11k -
swik.net/<B>jazzez</B> - 40k -
raveendran.wordpress.com/category/<B>jazzez</B>/ - 15k -
www.linkedin.com/pub/2/377/3A2 - 10k -
www.bebo.com/Profile.jsp?MemberId=4902204778 -
My need:
code.rb --> out contains my proper output. But i didn't able to
overwrite the same line in file.It means
1. single --> "wordpress.com/tag/<B>jazzez</B>/ - 11k - "
2. out4 --> "wordpress.com/tag/jazzez"
Here i want to replace the first line in hi.txt file 1 to 2.
Awaiting your reply
Regards,
P.Raveendran
RF, chennai
http://raveendran.wordpress.com
My code:
code.rb
lines=File.open("hi.txt","r")
output=[]
lines.each do |single|
out1=single.split(' ')
out2=out1[0].gsub('<B>', '')
out3= out2.gsub('</B>', '')
out4=out3.gsub('<WBR>','')
output << out4 # I need to overwrite the appropriate line.
end
hi.txt:
wordpress.com/tag/<B>jazzez</B>/ - 11k -
swik.net/<B>jazzez</B> - 40k -
raveendran.wordpress.com/category/<B>jazzez</B>/ - 15k -
www.linkedin.com/pub/2/377/3A2 - 10k -
www.bebo.com/Profile.jsp?MemberId=4902204778 -
My need:
code.rb --> out contains my proper output. But i didn't able to
overwrite the same line in file.It means
1. single --> "wordpress.com/tag/<B>jazzez</B>/ - 11k - "
2. out4 --> "wordpress.com/tag/jazzez"
Here i want to replace the first line in hi.txt file 1 to 2.
Awaiting your reply
Regards,
P.Raveendran
RF, chennai
http://raveendran.wordpress.com