in reply to Re: Parse string greater than 2GB
in thread Parse string greater than 2GB
You wrote:
$ perl -pe 's/\n//' /path/to/dataYour approach reads the data file (via standard input) one line at a time (delimited by newlines), and searches every line in its entirety to replace one newline character before the implicit -p loop prints them out. One can accomplish the same thing in about half the CPU time (depending on average line length) with:
$ perl -pe chomp /path/to/dataThe OP also indicated that they have to stick with the read() loop, so it's worth noting that solutions like these that read line by line don't fit the problem description. (Not that I don't have some significant doubts about the problem description...)
|
|---|