# Write to specified line number of file

**URL:** <https://www.ruby-forum.com/t/write-to-specified-line-number-of-file/97639>\
**Category:** Ruby\
**Created:** [July 9, 2006, 12:55am UTC](https://www.ruby-forum.com/t/write-to-specified-line-number-of-file/97639 "2006-07-09T00:55:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ar1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d9b06d/32.png) [@ar1](https://www.ruby-forum.com/u/ar1)\
**Post date:** [July 9, 2006, 12:55am UTC](https://www.ruby-forum.com/t/write-to-specified-line-number-of-file/97639/1 "2006-07-09T00:55:33Z")

</div>

Hi,

I want to read a file, and write to another file by randomize the lines.  
I saw the method File.lineno= but it doesn’t seem to work. I just get  
the same file written as the original, without the lines having been  
randomized.

I suppose it should be simple, but am new to Ruby. Any help would be  
great.

Thanks,

Asitya
