Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Mar 2010 13:24:06 -0700
From:      Gary Kline <kline@thought.org>
To:        bf1783@gmail.com
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: shell script to cap first letter?
Message-ID:  <20100321202406.GB92695@thought.org>
In-Reply-To: <d873d5be1003210716l833bf5l6fd7f8c8aa85a028@mail.gmail.com>
References:  <d873d5be1003210716l833bf5l6fd7f8c8aa85a028@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 21, 2010 at 10:16:22AM -0400, b. f. wrote:
> >i'm wondering if there is a script that i could run my plaintext
> >files thru that would capitalize thef first letter of each
> >sentence [[ assuming the character wasn't already a cap!]]
> >
> >more and more, in recent years, i have posted questions or
> >written things that have been sloppily or casually hacked
> >together in all lower case.  this filter would have to determine
> >what was and was not a sentence.  or a sentence fragment.
> >[ai]spell can catch "i've" and suggest "I've", etc.
> 
> You're asking a lot from a simple filter if you want it to
> discriminate between uses of "." to terminate a sentence, and other
> uses of "." that do not require the following word to be capitalized,
> such as the use of "." in abbreviations -- a lot of fairly
> sophisticated spelling and grammar checkers can fail to do this
> reliably.  But if you want a naive filter you could use textproc/gsed,
> with the /U GNU extension (our BSD sed(1) doesn't understand it),
> e.g.:
> 
> gsed -e 's|\(\.[.[:space:].]\)\([a-z]\)|\1\U\2|g'
> 
> or you could use BSD sed(1), together with a more cumbersome
> capitalization script, like the cflword[12345].sed scripts at:
> 
> http://sed.sourceforge.net/grabbag/scripts/#txfo
> 
> Or you could use Perl.  Or awk(1). Or script a [non-]interactive call
> to a more sophisticated spelling or grammar checker. Or roll your own.
>  For questions like this, try searching the web first.
> 
> b.

	given the sheer i.q. power ofthis list, i almost always ask 
	here first rather thsan hunting for something this obscure.
	thanks for the url, tho.  

	i'm pretty sure than *someone* has hacked every imagineable 
	function in at least this universe.  too bad that there are
	no web sites that have a library of them.  

	gary


-- 
 Gary Kline  kline@thought.org  http://www.thought.org  Public Service Unix
        http://jottings.thought.org   http://transfinite.thought.org
    The 7.79a release of Jottings: http://jottings.thought.org/index.php




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100321202406.GB92695>