in reply to Dealing with huge text string
Read it one record at a time:
open(INPUT,"filename.txt") or die "Will not open input: $!"; open(OUTPUT,">output.txt") or die "Will not open output: $!"; local $/ = \164; while( <INPUT> ) { ## Updated per jwkrahn's post below print OUTPUT "$_\n"; } close OUTPUT; close INPUT;
BTW: The semicolon after open(OUTPUT,">output.txt"); is kinda a givaway that you didn't have the error checking :)
As a one-liner:
perl -ple"BEGIN{$/=\164}" filename.txt >output.txt
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dealing with huge text string
by jwkrahn (Abbot) on Mar 28, 2008 at 13:32 UTC | |
|
Re^2: Dealing with huge text string
by PhilFromIndy (Initiate) on Mar 28, 2008 at 14:03 UTC | |
|
Re^2: Dealing with huge text string
by mobiusinversion (Beadle) on Mar 28, 2008 at 19:28 UTC |