[oak perl] RE: perl one liners

Belden Lyman blyman at iii.com
Wed Jan 22 10:52:40 CST 2003


Here's one solution.

perl -i -F'\t' -ape 's;;join qq/\t/, @F[0-5], $F[5]-$F[4];e' *




Aimal Pashtoonmal wrote:
> Dear Oakland,
> 
> I visited your site on one-line perl as trying to use one liner perl to
> subtract numbers in two columns, are yo able to help me please?
> 
> Hear is what a typical file looks like:
> 
> a12345.1   32323jkjkjk32k3j2j3    56565    dfdfdfdfdfd    10   20
> 454545
> b67891.1   54545k4l5k4lkl445     78787    ghghghghgh    15   30  667676
> 
> I am trying to subtract column 5 from column 6 and then to print the
> results in a new colum next to column 6 so that:
> 
> a12345.1   32323jkjkjk32k3j2j3    56565    dfdfdfdfdfd    10   20
> 10      454545
> b67891.1   54545k4l5k4lkl445     78787    ghghghghgh    15   30
> 15      667676
> 
> or even pass them into a new fil without the last column.
> 
> Kindest regards, amal.
> 
> 




More information about the Oakland mailing list