Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a line length limit for text files created from Perl?

While writing a Perl script, I got a requirement to write the user names with comma separation in only one line of the file.

That's why I would like to know is there any restriction on the maximum size of the line in the .txt file.

like image 523
kishore Avatar asked Sep 19 '09 12:09

kishore


Video Answer


1 Answers

Text files are just like any other files and newline character is like any othe character, so only the usual filesize restrictions apply (4Gb size limit on older file systems, file must fit on the disk etc.)

You won't encounter any problem reading and writing it, unless you're reading it line by line—you can run out of memory then or encounter a buffer overflow of sorts. This may happen in any text editor or text processing program (such as sed or awk), because, unlike OS kernel, in those line separation matters

I would suggest keeping one user per line, as it's more natural to read and less error-prone when you process the file with an external program.

like image 174
P Shved Avatar answered Feb 22 '23 22:02

P Shved