Thanks for the help.
File.rename is behaving strangely. The file name ended up have an extra
non-printing character at the end. Instead of naming the file "filename"
it names it "filename^J".
I don't know what character "^J" is.
I'm on a SPARC computer (in case that matters).
I got the probram working by just doing `mv old.txt #{filename}`, but I
thought I'd mention this apparent bug.
Daniel.
> > I want to read each line, process it, print that to another file, and then
> > rename the output file.
>
> Something like this will do...
>
> lines = File.readlines('in.txt')
>
> File.open('out.txt', 'w+') do |fout|
> lines.each do |ln|
> ln.gsub!(...)
> fout.puts ln
> end
> end
>
> File.rename('out.txt', 'out.txt')
>
>
>
>