#!/usr/bin/perl # http://perlmonks.org/?node_id=1199646 use strict; use warnings; use Path::Tiny; local $/ = "\nEnd"; while(<DATA>) # read section to (and including) End { $_ .= do { local $/ = "\n"; <DATA> }; # complete last line /\nEnd (\d+).*$/ and path("OUTFILE$1")->append($_); } __DATA__ Start:/abc/def ..... End 1.2 Start:/xyz/uvw ..... End 2.8
In reply to Re: Splitting a file based on matched conditions
by tybalt89
in thread Splitting a file based on matched conditions
by skumar_pm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |