Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li>For <em>Huge</em> data files, I'd recommend <a href="http://search.cpan.org/perldoc?Sort%3a%3aExternal" rel="nofollow"><code>Sort::External</code></a>. </li> <li>It doesn't look like you need to parse the brackets, if the indentation does the job. Then you have to do it on "breaks", or when the indentation level 0, then you process the last record gathered, so you always look ahead one line.</li> </ul> <p>So:</p> <pre><code>sub to_sort_form { my $buffer = $_[0]; my ( $id ) = $buffer =~ m/(0x\p{AHex}{8})/; # grab the first candidate return "$id-:-$buffer"; $_[0] = ''; } sub to_source { my $val = shift; my ( $record ) = $val =~ m/-:-(.*)/; $record =~ s/\$--\^/\n/g; return $record; } my $sortex = Sort::External-&gt;new( mem_threshold =&gt; 1024**2 * 16 # default: 1024**2 * 8 (8 MiB) , cache_size =&gt; 100_000 # default: undef (disabled) , sortsub =&gt; sub { $Sort::External::a cmp $Sort::External::b } , working_dir =&gt; $temp_directory # default: see below ); my $id; my $buffer = &lt;&gt;; chomp $buffer; while ( &lt;&gt; ) { my ( $indent ) = m/^(\s*)\S/; unless ( length $indent ) { $sortex-&gt;feed( to_sort_form( $buffer )); } chomp; $buffer .= $_ . '$--^'; } $sortex-&gt;feed( to_sort_form( $buffer )); $sortex-&gt;finish; while ( defined( $_ = $sortex-&gt;fetch ) ) { print to_source( $_ ); } </code></pre> <p><strong>Assumptions:</strong></p> <ul> <li>The string <code>'$--^'</code> does not appear in the data on its own.</li> <li>That you're not alarmed about two 8-hex-digit strings in one record.</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload