Please give a better problem statement like what is the form of data
initially present in the file and what you wish to extract.

You should also post sample file data for both the files (before and after)

Not all people who know Perl might know Unix commands (rare but
possible) and so they may not be able to construct the requirement.

Thanks,
Parag

On Thu, Sep 1, 2011 at 4:38 PM, Rajeev Prasad <rp.ne...@yahoo.com> wrote:
> from linux:
>
> cut -f1,5- -d" " file |grep -v "^0" | sort -n > to_file;   <======this line: 
> how to achieve this in perl?
>
>
> will below work,  in perl?
>
> if ( ! -s $sourcedir/somefile ){
>
>  open(tmpFH,"<","file2");
>  @tmpAR = <tmpFH>;
>  close(tmpFH);
>
>  push(@tmpAR2,$tmpAR[0],$tmpAR[5..]);        #select on columns 1 and 5 
> onwards from the original file
>
>  my @tmpAR3 = grep {!^[0 ]} @tmpAR2;         #omit line with 0 in the 
> beginning
>
>  @tmpAR3 = sort(@tmpAR3);                        # sort on the first column
>  }
>
> we can then print tmpAR3 to a file.
>
>
> plz. advice. thx.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to