Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'correct.': 0.07; 'subject:file': 0.07; 'expectation': 0.09; 'question?': 0.09; 'received:mail-qc0-f174.google.com': 0.09; 'subject:files': 0.09; 'subject:into': 0.09; 'throw': 0.09; 'thrown': 0.09; 'cc:addr :python-list': 0.10; '24,': 0.16; 'both,': 0.16; 'oct': 0.16; 'subject:based': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'everyone,': 0.17; 'code,': 0.18; 'code.': 0.20; 'cc:2**0': 0.23; 'split': 0.23; 'cc:no real name:2**0': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; '-0700,': 0.29; "d'aprano": 0.29; 'steven': 0.29; 'expect': 0.31; 'you?': 0.32; 'file': 0.32; 'certain': 0.33; 'times.': 0.33; 'received:google.com': 0.34; 'text': 0.34; 'especially': 0.35; 'so,': 0.35; 'received:209.85': 0.35; 'should': 0.36; 'enough': 0.36; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'little': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'excited': 0.63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=871+keSixU/YjIQz89oAFOhP3cYCbAP10H/LfkGWMRc=; b=N4qPDN6YNci33fV4VtsWAyw7nwa/f1OwahwhUIJnkbaTjnr0KMrK8hdQhj9PSSYx6y UfZZOxEOHN+zgndgcJrNqYCedhcwZSJzPgAK3xUAIH8dHuImtZknoZYTaUjXyWHymR99 VIhTEzhMolFlKgAkM8zYHiDqPAOfR3XV9KKYMEYVhE7JRHYMiv7tMb4Z39XOAIG6if35 19vDduMnbdBkwadIfp/57QzWIzGzv8B/jYbQphYn7Rr5s4X/nejsmuadqugJyAuWBc6g 4mPOrKz/i+WXrE4/VhMcmI3CF/hOuCh8S3srDz7SJOSKUysZn/5VxCXVPgYhKakoXEsQ y5aQ== MIME-Version: 1.0 In-Reply-To: <50879e26$0$29882$c3e8da3$5496439d@news.astraweb.com> References: <9ae3b43a-5c69-4232-a1cf-e2dd0c4ee2ca@googlegroups.com> <50879e26$0$29882$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 24 Oct 2012 04:02:17 -0400 Subject: Re: Split single file into multiple files based on patterns From: David Hutto To: "Steven D'Aprano" Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351065740 news.xs4all.nl 6859 [2001:888:2000:d::a6]:46800 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32018 On Wed, Oct 24, 2012 at 3:52 AM, Steven D'Aprano wrote: > On Tue, 23 Oct 2012 20:01:03 -0700, satyam wrote: > >> I have a text file like this >> >> A1980JE39300007 2732 4195 12.527000 > [...] > >> I want to split the file and get multiple files like A1980JE39300007.txt >> and A1980KK18700010.txt, where each file will contain column2, 3 and 4. > > Are you just excited and want to tell everyone, or do you actually have a > question? > > Have you tried to write some code, or do you just expect others to do > your work for you? > > If so, I see that your expectation was correct. > > > > -- > Steven Some learn better with a full example, better than any small challenge that can be thrown in at certain times. I think it should be a little of both, especially if you (an algorithmitist for the OP)only have enough time to throw out untested pseudo code. -- Best Regards, David Hutto CEO: http://www.hitwebdevelopment.com