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


Groups > comp.lang.python > #27626

Re: help me debug my "word capitalizer" script

References <CAE7MaQbrdVbbFWDJ8GHuoybT2SNPfZyyMFU_beBc_zMKpBHPFg@mail.gmail.com> <CAEtwbM0PwcSb6v5MZ=Dr3s9TVFoXzCOywd=JfWFfBUcM-RFLcQ@mail.gmail.com>
Date 2012-08-22 20:41 +1000
Subject Re: help me debug my "word capitalizer" script
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3644.1345632103.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Aug 22, 2012 at 8:28 PM, Kamil Kuduk <kamil.kuduk@gmail.com> wrote:
>> 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"

Why less? Why not just redirect input?

Though, this isn't really on topic for Python.

ChrisA

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


Thread

Re: help me debug my "word capitalizer" script Chris Angelico <rosuav@gmail.com> - 2012-08-22 20:41 +1000

csiph-web