Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 $_; } }


Comment on Re^4: Split file using perl and regexp
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013900]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2015-07-07 04:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls