Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!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.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:help': 0.07; 'subject:script': 0.09; 'cc:addr:python-list': 0.10; 'file,': 0.15; 'all?': 0.16; 'letters.': 0.16; 'sed': 0.16; 'received:209.85.214.174': 0.21; 'cc:2**0': 0.23; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'skip:" 20': 0.26; 'message-id:@mail.gmail.com': 0.27; 'words': 0.29; 'received:google.com': 0.34; 'received:209.85': 0.35; 'subject:" ': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'received:209.85.214': 0.39; 'easily': 0.39; 'header:Received:5': 0.40; 'first': 0.61; 'leaving': 0.62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=NniG1JK2v0q0dvIsVEBO9/1vz89r+MjTYqK33ScUhjI=; b=eqFZM95huiYGDlitOa9Q1QCUT+VflE0y7YLVzBVTKcy7HOFC/qqDjrRZ8duRni25dN Y2JlLtSfQ1OhNwSfmuU6MYreGOon/oz9LjGxj7/je4+GrG+p4esXFiy1a5Zcp1fp6uId ZdpyLVQPQcQEeQXYlOYxD1arGSVCrMJR6S0G9YlS4oQXQifOuek7oxTW1uj6n/9L0EG4 f1DDzdoSa9SkZibRBw4bVlvs+maDS/BjbjVu44R5DxgC0Vpj0kVGKA6qLaBzs3iYKjRL 1o3hId2Ml5/wWvOBbHlq6rsm/tEcr1joN68fA5qTZzAT9x0X+VtT+VzAARLjevniNMNx osPA== MIME-Version: 1.0 In-Reply-To: References: From: Kamil Kuduk Date: Wed, 22 Aug 2012 12:28:18 +0200 Subject: Re: help me debug my "word capitalizer" script To: Santosh Kumar Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list 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: 7 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345631321 news.xs4all.nl 6913 [2001:888:2000:d::a6]:55045 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27625 > Purpose of the script: > To capitalize the first letter of any word in a given file, leaving > words which have 3 or less letters. First or all? If first and this is the only purpose of the script you can easily use sed: less file.txt | sed -e "s/\b\([a-z]\{4,\}\)/\u\1/g"