Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'passes': 0.05; 'sure,': 0.09; 'to:addr:python.list': 0.09; 'to:addr:tim.thechases.com': 0.09; 'to:name:tim chase': 0.09; 'subject:file': 0.13; 'cc:addr :python-list': 0.15; '-tkc': 0.16; 'grep': 0.16; 'received:10.0.1.2': 0.16; 'received:166.84': 0.16; 'received:166.84.1': 0.16; 'received:166.84.1.89': 0.16; 'received:mailbackend.panix.com': 0.16; 'received:panix.com': 0.16; 'roy': 0.16; 'wrote:': 0.16; 'jan': 0.19; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'received:166': 0.23; 'cc:2**0': 0.25; 'pm,': 0.26; 'tools,': 0.28; 'pass': 0.28; 'cc:addr:python.org': 0.29; '22,': 0.30; 'x-mailer:apple mail (2.1084)': 0.30; 'done': 0.33; 'this.': 0.33; 'charset:us-ascii': 0.36; 'but': 0.37; 'using': 0.37; 'could': 0.37; 'received:10.0.1': 0.38; 'subject:from': 0.39; 'data,': 0.39; 'subject:: ': 0.39; 'type': 0.60; 'header:Message-Id:1': 0.62; 'stand': 0.72; '2012,': 0.84; 'subject:content': 0.84 Subject: Re: Splitting a file from specific column content Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Roy Smith In-Reply-To: <4F1C628F.1000105@tim.thechases.com> Date: Sun, 22 Jan 2012 14:26:29 -0500 Content-Transfer-Encoding: quoted-printable References: <4F1C628F.1000105@tim.thechases.com> To: Tim Chase X-Mailer: Apple Mail (2.1084) Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1327260402 news.xs4all.nl 6847 [2001:888:2000:d::a6]:34994 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19228 I stand humbled. On Jan 22, 2012, at 2:25 PM, Tim Chase wrote: > On 01/22/12 08:45, Roy Smith wrote: >> I would do this with standard unix tools: >>=20 >> grep '^[012]' input.txt> first-three-seconds.txt >> grep '^[34]' input.txt> next-two-seconds.txt >> grep '^[567]' input.txt> next-three-seconds.txt >>=20 >> Sure, it makes three passes over the data, but for 20 MB of data, you >> could have the whole job done in less time than it took me to type = this. >=20 >=20 > If you wanted to do it in one pass using standard unix tools, you can = use: >=20 > sed -n -e'/^[0-2]/w first-three.txt' -e'/^[34]/w next-two.txt' = -e'/^[5-7]/w next-three.txt' >=20 > -tkc >=20 >=20 >=20 -- Roy Smith roy@panix.com