in reply to Help for generating multiple file from singl e file and parsing it.

I need to pick data after #RD# till #OE#
open my $INFILE, '<', 'myfile'; my $number = 0; while ($INFILE){ $_ =~ m/\#RD\#(.*?)\#OE\#/; my $number++; open my $OUTFILE, '>', "outfile$number"; print $OUTFILE $1; close $OUTFILE; } close $INFILE;
date after #OE# till the end of line will be inside individual output file.if data between #RD# and #OE# is repeated that will come in same individual output file.

??. don't understand this. Could you explain better what do you want to do?

  • Comment on Re: Help for generating multiple file from singl e file and parsing it.
  • Download Code

Replies are listed 'Best First'.
Re^2: Help for generating multiple file from singl e file and parsing it.
by sarf13 (Beadle) on Oct 15, 2011 at 21:08 UTC
    thank you very much for your kind reply.
    actually i want to pick data between #RO# and #OE# use this data as name of output file for example in give data individual file generated will be
    1. "3023 N MANS.20111011.2.txt"
    2. "3004 N MANS.20111011.2.txt" inside this newly generated file i want to write data after #OE# till newline like in file eg. "3023 N MANS.20111011.2.txt" data should written "#OE#,CR,N,284110161544,,Y,MANS,20111011064839000,20111011~1M9LQV49HM"

    one more thing which i need to do is if output file having same name like
    "3023 N MANS.20111011.2.txt"
    3023 N MANS.20111011.2.txt
    the data come inside single file. appreciate for you help.
      You can create a filename with "," and spaces inside, but I don't recommend this. You should replace all "," in the first chain (i.e by "_") before passing this as a filename.