in reply to separating every set of textline
hope this helps,#!/usr/bin/perl use strict; my ($file); open(FILE, "<file.txt"); while(<FILE>) { chomp($_); if(/CITY/ ... /FLORIDA/) { if( ($file) = $_ =~ m/.+CITY:\s+(\w+)\s+/ ) { close(FH); $file .= '.txt'; open(FH, ">>$file"); } print FH "$_\n" unless $_ =~ m/FLORIDA/; } } close(FILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: separating every set of textline
by deibyz (Hermit) on Mar 02, 2005 at 10:25 UTC |