i split one perl script, it got split ,i combined it , it's not working???
Though the siza are same.
what is the problem.

Regards 
j@veed





-----Original Message-----
From: Tanton Gibbs [mailto:thgibbs@;deltafarms.com]
Sent: Thursday, October 24, 2002 11:12 AM
To: [EMAIL PROTECTED]
Subject: Re: Splitting A large data file


Also, there is a CPAN utility for doing this

http://search.cpan.org/author/SDAGUE/ppt-0.12/bin/split
----- Original Message -----
From: "Todd W" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 24, 2002 1:36 AM
Subject: Re: Splitting A large data file


>
>
> Javeed Sar wrote:
>  >
> > How to combine it back after split???
> >
>
> perl -e 'print <>' splitfile.1 splitfile.2 splitfile.3 splitfile.4
> splitfile.5 > splitfile.new.txt
>
> note the ordering is different, because the program below sends the next
> record to the next filehandle in a circle. The above one liner dumps the
> contents of the files sequentially. But if your datafile implementation
> is sound that shouldnt matter.
>
> Todd W.
>
> >
> > James Kipp wrote:
> >
> >>I am working on a Windows NT box and I don't have the luxury of any file
> >>splitting utilities. We have a data file with fixed length records. I
was
> >>wondering the most efficient way of splitting the file into 5 smaller
> >
> > files.
> >
> >>Thought ( Hoping :-) ) some one out there may have done something like
> >
> > this.
> >
> >>
> >>Thanks !!
> >
> >
> > #!/usr/bin/perl -w
> >
> > use strict;
> >
> > # call new() with named args found in init() to override defaults
> > my( $fSpliter ) = Text::FileSplitter->new();
> >
> > $fSpliter->split();
> >
> > print( "done!\n" );
> >
> > package Text::FileSplitter;
> > use strict;
> > use IO::File;
> >
> > sub new {
> >    my($class, %args) = @_;
> >    my($self) = bless( { %args }, $class );
> >    $self->init();
> >    return( $self );
> > }
> >
> > sub init {
> >    my($self) = shift(); my($filehandles) = [];
> >
> >    $self->{ file } ||= './splitfile.txt';
> >    $self->{ output_prefix } ||= ( ($self->{ file } =~ /(\w+)/) and $1 );
> >    $self->{ file_count }  ||= 5;
> >    $self->{ record_length }  ||= 10;
> >
> >    $self->{ fh } = IO::File->new( "< $self->{ file }" )
> >      or die("open $self->{ file }: $!");
> >
> >    foreach ( 1 .. $self->{ file_count } ) {
> >      push(
> >        @{ $filehandles },
> >        IO::File->new("> $self->{ output_prefix }.$_")
> >      );
> >    }
> >    $self->{ ofh } = $filehandles;
> >
> > }
> >
> > sub split {
> >    my($self) = shift(); my($buffer);
> >    my($counter) = 0;
> >    while ( sysread $self->{ fh }, $buffer, $self->{ record_length } ) {
> >      $self->{ ofh }[ $counter % $self->{ file_count } ]->print(
$buffer );
> >      $counter++;
> >    }
> > }
> >
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to