[CentOS] Conversion of text in shell

William L. Maltby CentOS4Bill at triad.rr.com
Sun Oct 14 13:34:56 UTC 2007


On Fri, 2007-10-12 at 17:15 -0400, Marko A. Jennings wrote:
> On Fri, October 12, 2007 4:54 pm, roland hellström wrote:
> ><snip>

> Assuming that you have those lines in a file called numbers.txt, you can
> execute the following (all on one line):
> 
> cat numbers.txt | tr '.,e' ',^^' | awk -F^ '{printf("%s & $%s \\cdot
> 10^{%s}$\\\\\n", $1, $2, $3);}'

Just a reminder from an old anal-retentive: the creation of the extra
process (for cat) and the creation of a pipe is not needed. Use the
standard input redirection available in bash.

   tr .... < numbers.txt

will do the job.


> <snip>

--
Bill




More information about the CentOS mailing list