in reply to Re: Coping a part of text file
in thread Coping a part of text file

sub To_header { my $ff; my $iz; open($ff,">hr.txt"); for ($iz=0;$iz<=$temp[0];$iz++) { print $ff "$words[$iz]" ; } }

here words is an array of words of file and temp[0] has the address till where I wish to print and I am printing it in hr.txt

Replies are listed 'Best First'.
Re^3: Coping a part of text file
by Anonymous Monk on Jul 04, 2013 at 08:08 UTC

    Ok, here is my commentary

    sub To_header { my( $outfile, $startix, $endix , $words ) = @_; use autodie; open my($outfh), '>', $outfile ; ## or die by autodie for my $ix ( $startix .. $endix ){ print $outfh $words->[ $ix ]; } close $outfh; } To_header( 'hr.txt', 0, $temp[0], \@words );

    If you want something more specific you'll have to provide more details as How do I post a question effectively? and davido explain

      hey one small point , that instead of splitting into words , we have the start index and where to stop , where ever we find the word Data List , so we just have to copy that exact block from one file to another , can we use grep in that file to search for it and copy paste that using script , just an idea can we do it

        hey one small point , that instead of splitting into words , we have the start index and where to stop , where ever we find the word Data List , so we just have to copy that exact block from one file to another , can we use grep in that file to search for it and copy paste that using script , just an idea can we do it

        grep as in grep or grep?

        I imagine grep could be involved , but its probably not the best fit

        based on what I've read in this thread, Outlook not so good