[Perl] One liner calculus

In the following example file « calc.txt », I want to multiply each number by 2/3 :

199,119
326,147
385,345
250,330
157,218
67,241
402,175

Here is the solution in one line with Perl :

[pene@donunix] perl -pi.bak -e 's|(\d+),(\d+)|int($1*2/3).",".int($2*2/3)|e' calc.txt

No comments: