K
kevin kitenik
Hi everybody,
i need to make an arithmetic operation ine one field in a csv file.
exp:
cat file
a ; 123
b ; 432
c ; 45
i need a one liner perl code to substitute the second filed by
its value divided by 10
to have
a ; 12.3
b ; 43.2
c ; 4.5
i need this sample of code:
perl -i -pe 's/;(\d+)/ $1/10 /' file
this can't work because i dont know how to tell perl
to execute $1/10 (or even $1 - 10 )
please, help, i know i can do it onether way,
but want to know if this is possible
because it's so easy (one line)
i need to make an arithmetic operation ine one field in a csv file.
exp:
cat file
a ; 123
b ; 432
c ; 45
i need a one liner perl code to substitute the second filed by
its value divided by 10
to have
a ; 12.3
b ; 43.2
c ; 4.5
i need this sample of code:
perl -i -pe 's/;(\d+)/ $1/10 /' file
this can't work because i dont know how to tell perl
to execute $1/10 (or even $1 - 10 )
please, help, i know i can do it onether way,
but want to know if this is possible
because it's so easy (one line)