Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:file': 0.07; 'subject:files': 0.09; 'subject:into': 0.09; 'cc:addr:python- list': 0.10; '3465': 0.16; 'generally?': 0.16; 'grouped': 0.16; 'received:209.85.216.53': 0.16; 'subject:based': 0.16; 'sender:addr:gmail.com': 0.18; 'cc:2**0': 0.23; 'split': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'file': 0.32; 'received:google.com': 0.34; 'text': 0.34; 'received:209.85': 0.35; 'received:209': 0.37; 'received:209.85.216': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'shows': 0.38; 'where': 0.40; 'header:Received:5': 0.40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=03fPI1HfqgUMVS/h561rGKZgyLV6DR5wP/LZglalcZM=; b=VTgYZpb6xYjdbL0+UQ6XCNoD4OJgezjk2xq5AtzDYlgktehDpifbvmB347Cb4n//51 uDChoyiG8bqBVhX28b74KL629UwGZ0VxgzgSvWqbtVlnTwIXKhJXCB8th4Dc0NeWClxU 3Dmci+dIFpCEAflT2xnUdh9yaiJPMdhU30utQgakA/Y89gKqMjBxMD05UZJQoUuSdasv KWzEKEXL052PWd8JJ9+pAqup09IM476BpsiAC1iO7JQO4mCM2OQkX1n3mwHRSnDXDhsz 0vttt3EcKwA9HF5ePD1IX/Ab3O86yX6ir1REjxJku/DpMMAe39rTJcbQ1KIcBnma3BPY qzGA== MIME-Version: 1.0 Sender: jsf80238@gmail.com In-Reply-To: <9ae3b43a-5c69-4232-a1cf-e2dd0c4ee2ca@googlegroups.com> References: <9ae3b43a-5c69-4232-a1cf-e2dd0c4ee2ca@googlegroups.com> Date: Tue, 23 Oct 2012 21:36:49 -0600 X-Google-Sender-Auth: pyA549ybkX5qQah2vfBz7OgmdLE Subject: Re: Split single file into multiple files based on patterns From: Jason Friedman To: satyam 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: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351049812 news.xs4all.nl 6840 [2001:888:2000:d::a6]:52868 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31986 > I have a text file like this > > A1980JE39300007 2732 4195 12.527000 > A1980JE39300007 3465 9720 22.000000 > A1980KK18700010 186 3366 4.780000 > A1980KK18700010 30 186 1.285000 > A1980KK18700010 30 185 4.395000 > A1980KK18700010 185 186 9.000000 > A1980KK18700010 25 30 3.493000 > > 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. The sample data above shows the data grouped by file name. Will this be true generally?