<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>Re: [CentOS] Conversion of text in shell</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>

<P><FONT SIZE=2>As it turns out this was a CS class exercise in using sed and regex.<BR>
<BR>
And excuse me, but you ARE using regular expressions in your example...<BR>
<BR>
-Ross<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: centos-bounces@centos.org <centos-bounces@centos.org><BR>
To: CentOS mailing list <centos@centos.org><BR>
Sent: Mon Oct 15 17:07:11 2007<BR>
Subject: Re: [CentOS] Conversion of text in shell<BR>
<BR>
Ross S. W. Walker wrote:<BR>
> Ross S. W. Walker wrote:<BR>
>> roland hellström wrote:<BR>
>>> OK! I finally figured out the solution for all you people out<BR>
>>> the eager to hear it!!!<BR>
>>> it was infact very very similar to the last line I sent...<BR>
>> this is it<BR>
>>> sed 's/\([^\.]*\).\([^,]*\),\([^\.]*\).\([^e]*\)e\(.*\)/\1,\2<BR>
>>> \& $\3,\4 \\cdot 10^{\5}$\\\\/'<BR>
>>><BR>
>>> omg I feel so h4xx0r figuring that out myself lol<BR>
>>> Thx for the help all :)<BR>
>> I am surprised you got it all in 1 regex, I was aiming more for:<BR>
>><BR>
>> sed 's/,/ & /;s/\./,/;s/\(.*\)e\(.*\)/\1 \\cdot 10^{\2}/'<BR>
><BR>
> whoops, I made a mistake:<BR>
><BR>
> sed 's/,/ \& /;s/\./,/g;s/\(.*\)e\(.*\)/\1 \\cdot 10^{\2}\$\\\\/'<BR>
><BR>
> You need the 'g' option in the second substitute to perform a<BR>
> global, and of course the proper cdot expression.<BR>
><BR>
<BR>
you don't need regex:<BR>
<BR>
sed \<BR>
        -e '/^ *$/d' \<BR>
        -e 's/,/ \& $/' \<BR>
        -e 's/\./,/g'  \<BR>
        -e 's/e/ \\cdot 10^{/' -e s'/$/}$\\\\/' \<BR>
                /path/to/input/file<BR>
<BR>
now, the exercice is to read the input file directly with LaTeX using<BR>
TeX macros instead of converting it.<BR>
<BR>
_______________________________________________<BR>
CentOS mailing list<BR>
CentOS@centos.org<BR>
<A HREF="http://lists.centos.org/mailman/listinfo/centos">http://lists.centos.org/mailman/listinfo/centos</A><BR>
</FONT>
</P>


<P></P>
<HR WIDTH="100%">
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.

</BODY>
</HTML>