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
I am trying to create a script for each scenario and pass it as variable.$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 $_; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Split file using perl and regexp
by Kenosis (Priest) on Jan 17, 2013 at 22:06 UTC |
In Section
Seekers of Perl Wisdom