From: suresh [mailto:
[email protected]]
# I have a HUGE data file multiple lines of data. I want to delete =20
just
# the first line from it. How to do it efficiently?
i think you want something fast yet clean ruby solution.
maybe something like,
botp@botp-desktop:~$ cat test.txt
this line will be deleted
2nd line
3rd asdfasdf line
4th qwerty line
5th
6th six
7th 777777777777
botp@botp-desktop:~$ irb
irb(main):001:0> File.open("newfile","w") do |fw|
irb(main):002:1* File.open("test.txt") do |fr|
irb(main):003:2* fr.gets
irb(main):004:2> fw.write fr.read
irb(main):005:2> end
irb(main):006:1> end
=3D> 72
botp@botp-desktop:~$ cat newfile
2nd line
3rd asdfasdf line
4th qwerty line
5th
6th six
7th 777777777777
just add some checks/rescues so that it will work on all your cases.
kind regards -botp