Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #17623

Re: Text Processing

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <nicholas.dokos@hp.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.126
X-Spam-Level *
X-Spam-Evidence '*H*': 0.75; '*S*': 0.00; 'subject:Processing': 0.09; 'python?': 0.15; 'awk': 0.16; 'confused.': 0.16; 'nick': 0.16; 'workaround': 0.16; 'cc:addr:python-list': 0.16; 'looked': 0.16; 'wrote:': 0.18; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'module': 0.26; 'all,': 0.28; "skip:' 10": 0.29; 'cc:addr:python.org': 0.29; 'modules,': 0.30; 'does': 0.32; 'tue,': 0.32; 'there': 0.33; 'yourself.': 0.34; 'something': 0.35; 'file': 0.36; 'similar': 0.36; 'cc:2**1': 0.36; 'but': 0.37; 'not,': 0.37; 'could': 0.37; "i'd": 0.39; 'skip:- 50': 0.39; 'quick': 0.61; '2011': 0.61; 'header:Received:6': 0.61; 'size.': 0.71; 'reply-to:no real name:2**0': 0.72; 'subject:Text': 0.73; 'header:Reply-to:1': 0.84; '-0800': 0.84; '10mb': 0.84; '0.00': 0.91
To =?UTF-8?B?SsOpcsO0bWU=?= <jerome@jolimont.fr>
From Nick Dokos <nicholas.dokos@hp.com>
Subject Re: Text Processing
In-Reply-To Message from =?UTF-8?B?SsOpcsO0bWU=?= <jerome@jolimont.fr> of "Tue\, 20 Dec 2011 21\:03\:21 +0100." <20111220210321.77451e19@bouzin.lan>
References <209c2abf-dd56-4a7f-839b-fad92920d457@m7g2000vbc.googlegroups.com> <20111220210321.77451e19@bouzin.lan>
Organization HPCS
X-Mailer MH-E 8.3; nmh 1.3; GNU Emacs 24.0.90
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding quoted-printable
Date Tue, 20 Dec 2011 16:04:45 -0500
Sender nicholas.dokos@hp.com
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To nicholas.dokos@hp.com
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3885.1324418997.27778.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1324418997 news.xs4all.nl 6989 [2001:888:2000:d::a6]:52037
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17623

Show key headers only | View raw


Jérôme <jerome@jolimont.fr> wrote:

> Tue, 20 Dec 2011 11:17:15 -0800 (PST)
> Yigit Turgut a écrit:
> 
> > Hi all,
> > 
> > I have a text file containing such data ;
> > 
> >         A                B                C
> > -------------------------------------------------------
> > -2.0100e-01    8.000e-02    8.000e-05
> > -2.0000e-01    0.000e+00   4.800e-04
> > -1.9900e-01    4.000e-02    1.600e-04
> > 
> > But I only need Section B, and I need to change the notation to ;
> > 
> > 8.000e-02 = 0.08
> > 0.000e+00 = 0.00
> > 4.000e-02 = 0.04
> > 
> > Text file is approximately 10MB in size. I looked around to see if
> > there is a quick and dirty workaround but there are lots of modules,
> > lots of options.. I am confused.
> > 
> > Which module is most suitable for this task ?
> 
> You could try to do it yourself.
> 

Does it have to be python? If not, I'd go with something similar to

   sed 1,2d foo.data | awk '{printf("%.2f\n", $2);}'

Nick

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Text Processing Yigit Turgut <y.turgut@gmail.com> - 2011-12-20 11:17 -0800
  Re: Text Processing Dave Angel <d@davea.name> - 2011-12-20 14:57 -0500
  Re: Text Processing Jérôme <jerome@jolimont.fr> - 2011-12-20 21:03 +0100
  Re: Text Processing Nick Dokos <nicholas.dokos@hp.com> - 2011-12-20 16:04 -0500
  Re: Text Processing Alexander Kapps <alex.kapps@web.de> - 2011-12-21 01:01 +0100
    Re: Text Processing Yigit Turgut <y.turgut@gmail.com> - 2011-12-22 03:11 -0800

csiph-web