Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Splitting a file based on matched conditions

by tybalt89 (Priest)
on Sep 19, 2017 at 14:24 UTC ( #1199681=note: print w/replies, xml ) Need Help??


in reply to Splitting a file based on matched conditions

#!/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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1199681]
help
Chatterbox?
[talexb]: Yep .. came across SuSE 6.2 in my storage locker recently. How old is that.
[erix]: 2001 :)
[erix]: (I have the wp pages open :))
[talexb]: 2001 sounds about right .. got myself a separate box just to run Linux on. Seriously clueless.

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2018-07-17 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (374 votes). Check out past polls.

    Notices?