From: Alexander McMillan Date: 2012-12-23T20:38:11+09:00 Subject: Re: trying to strip characters from a line --_4a025de8-9f14-440d-bb7d-5c67be3244e1_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable If you are trying to strip characters from a line in a web page file .html = why may I ask are you using the "a" file opening mode? The "a" mode is to a= ppend to the bottom of a file. > Date: Fri=2C 21 Dec 2012 23:15:52 +0900 > From: lists@ruby-forum.com > Subject: Re: trying to strip characters from a line > To: ruby-talk@ruby-lang.org >=20 > This finally worked=2C although it's certainly not elegant: >=20 > n_rows.times do > begin > file =3D File.open("archive.html"=2C "a") > line =3D rs.fetch_row.to_s > line.gsub! '['=2C '' > line.gsub! '"'=2C '' > line.gsub! ']'=2C '' > line.gsub! '=2C'=2C '' > file.write(line) > file.puts "
" > end > end >=20 >=20 > Thanks once again to everyone for their suggestions. >=20 > --=20 > Posted via http://www.ruby-forum.com/. >=20 = --_4a025de8-9f14-440d-bb7d-5c67be3244e1_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
If you are trying to strip chara= cters from a line in a web page file .html why may I ask are you using the = "=3Ba"=3B file opening mode? The "=3Ba"=3B mode is to appen= d to the bottom of a file.

> Date:=3B Fri=2C 21 Dec 2012 23:= =3B15:=3B52 +=3B0900
> From:=3B lists@=3Bruby-forum.com
>= Subject:=3B Re:=3B trying to strip characters from a line
> To= 8=3B ruby-talk@=3Bruby-lang.org
>
> This finally worked=2C althou= gh it'=3Bs certainly not elegant:=3B
>
> n_rows.times do> begin
> file ==3B File.open(=3B"=3Barch= ive.html"=3B=2C "=3Ba"=3B)=3B
> line ==3B rs.= fetch_row.to_s
> line.gsub!=3B '=3B[=3B'=3B=2C &= #39=3B'=3B
> line.gsub!=3B '=3B"=3B'=3B=2C &#= 39=3B'=3B
> line.gsub!=3B '=3B]=3B'=3B=2C = 9=3B'=3B
> line.gsub!=3B '=3B=2C'=3B=2C '=3B&= #39=3B
> file.write(=3Bline)=3B
> file.= puts "=3B<=3Bbr>=3B"=3B
> end
> end
>
= >
> Thanks once again to everyone for their suggestions.
>
> -- =
> Posted via http:=3B//www.ruby-forum.com/.
>
= --_4a025de8-9f14-440d-bb7d-5c67be3244e1_--