[CentOS] Conversion of text in shell
John R Pierce
pierce at hogranch.com
Sat Oct 13 00:00:49 UTC 2007
Ross S. W. Walker wrote:
> Ross S. W. Walker wrote:
>
>> roland hellström wrote:
>>
>>> OK! I finally figured out the solution for all you people out
>>> the eager to hear it!!!
>>> it was infact very very similar to the last line I sent...
>>>
>> this is it
>>
>>> sed 's/\([^\.]*\).\([^,]*\),\([^\.]*\).\([^e]*\)e\(.*\)/\1,\2
>>> \& $\3,\4 \\cdot 10^{\5}$\\\\/'
>>>
>>> omg I feel so h4xx0r figuring that out myself lol
>>> Thx for the help all :)
>>>
>> I am surprised you got it all in 1 regex, I was aiming more for:
>>
>> sed 's/,/ & /;s/\./,/;s/\(.*\)e\(.*\)/\1 \\cdot 10^{\2}/'
>>
>
> whoops, I made a mistake:
>
> sed 's/,/ \& /;s/\./,/g;s/\(.*\)e\(.*\)/\1 \\cdot 10^{\2}\$\\\\/'
>
some wag once said...
"Some people, when confronted with a problem, think "I know, I’ll use
regular expressions." Now they have two problems."
:)
More information about the CentOS
mailing list