[H-GEN] Splitting up a text file

Byron Ellacott bje at apnic.net
Mon Aug 21 02:05:50 EDT 2000


[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics.  Please observe the list's charter.          ]

On Mon, 21 Aug 2000, Adil, Kim - Brisbane (Maintenance) wrote:

> I had a look at the split function in perl, but again it appears to be
> concerned with splitting a line rather than somehow being able to keep
> paragraphs together that can be imported into a database.	

$para = 0;
$/ = "\n\n";
while ($line = <STDIN>) {
  open FILE, ">para$para.txt" or die "can't create para$para.txt: $!";
  print FILE $line;
  close FILE;
  $para++;
}

something like that

-- 
bje



--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.



More information about the General mailing list