Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^4: Split file using perl and regexp

by brad_nov (Novice)
on Jan 17, 2013 at 21:36 UTC ( #1013895=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

I am currently using the script like this

$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 $_; } }
I am trying to create a script for each scenario and pass it as variable.

Comment on Re^4: Split file using perl and regexp
Download Code
Replies are listed 'Best First'.
Re^5: Split file using perl and regexp
by Kenosis (Priest) on Jan 17, 2013 at 22:06 UTC

    By using data placeholders, viz., ~somedata~some data~~~~~~~~~~~~some data~~~~~, you may be omitting information that would assist in crafting a solution to accomplish your end--assuming you're not redacting information.

    Consider showing samples of the actual data, provided it's suitible for public consumption, as this will likely be more beneficial.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2015-12-01 00:02 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (788 votes), past polls