Re: change one line in a large fine

2022-11-20 Thread Kang-min Liu
linux...@gmx.net writes: > I have a large file which has millions of lines. > They are text only lines. > If I have to change one line in the file, what's the efficient way? > I don't want to slurp the whole file into memory, change that line and > write the full content back to disk again. It

Re: change one line in a large fine

2022-11-20 Thread support
May i ask a question about reading file? while(0){ print 'hi' } Will never print hi. cat 1.txt: 0 open FH, '1.txt' or die; while() { print 'hi' } This will print hi. Since $_ == 0 here, why while become true? I am confused about this. Regards November 20, 2022, 8:57 PM, "Kang-min Liu"

Re: change one line in a large fine

2022-11-20 Thread Ruprecht Helms (privat)
Hi, readline will be your friend. Just have a look in the example mentioned this link: https://www.tutorialspoint.com/perl/perl_readline.htm Regards, Ruprecht Am 20.11.22 um 15:41 schrieb supp...@openmbox.net: May i ask a question about reading file? while(0){ print 'hi' } Will never

change one line in a large fine

2022-11-20 Thread linuxguy
Hello perl world, I have a large file which has millions of lines. They are text only lines. If I have to change one line in the file, what's the efficient way? I don't want to slurp the whole file into memory, change that line and write the full content back to disk again. Thanks. -- To

Re: change one line in a large fine

2022-11-20 Thread Will Mengarini via beginners
* linux...@gmx.net [22-11/20=Su 09:58 +0100]: > I have a large file which has millions of lines. They are text > only lines. If I have to change one line in the file, what's the > efficient way? I don't want to slurp the whole file into memory, > change that line and write the full content