Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Split file using perl and regexp

by brad_nov (Novice)
on Jan 17, 2013 at 22:03 UTC ( #1013900=note: print w/replies, xml ) Need Help??


in reply to Re^3: Split file using perl and regexp
in thread Split file using perl and regexp

Currently I am using the below script to split into multiple files:
$split_file=$ARGV[0]; $split_file=~ s{.*/}{}; $split_file=~ s{\.[^.]+$}{}; print "split_file=$split_file\n"; while (<>) { if ( my ($m_id) = /^\d+\|(\d+?)\|/ ) { open my $fh, '>>', "${split_file}_" . $m_id . '.txt'; print $fh $_; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013900]
help
Chatterbox?
[LanX]: you don't see the whole picture
[LanX]: But reu germans have no humor, better to refrain from this site till the troll is gone...
[LanX]: true
[shmem]: I disagree
[LanX]: sure you are German
[shmem]: germans do have humour. Open debate is what germans, and what humour. There. :-)
[LanX]: :-P

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2017-04-27 19:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (512 votes). Check out past polls.