From owner-freebsd-questions@FreeBSD.ORG Sun Mar 21 20:24:10 2010 Return-Path: Delivered-To: freebsd-questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 757061065676 for ; Sun, 21 Mar 2010 20:24:10 +0000 (UTC) (envelope-from kline@thought.org) Received: from ethic.thought.org (plato.thought.org [209.180.213.209]) by mx1.freebsd.org (Postfix) with ESMTP id 16FA88FC0A for ; Sun, 21 Mar 2010 20:24:09 +0000 (UTC) Received: from thought.org (tao.thought.org [10.47.0.250]) (authenticated bits=0) by ethic.thought.org (8.14.3/8.14.3) with ESMTP id o2LKO6MC093705; Sun, 21 Mar 2010 13:24:06 -0700 (PDT) (envelope-from kline@thought.org) Received: by thought.org (nbSMTP-1.00) for uid 1002 kline@thought.org; Sun, 21 Mar 2010 13:24:06 -0700 (PDT) Date: Sun, 21 Mar 2010 13:24:06 -0700 From: Gary Kline To: bf1783@gmail.com Message-ID: <20100321202406.GB92695@thought.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: With 23 years of service to the Unix community. X-Spam-Status: No, score=-0.1 required=3.6 tests=ALL_TRUSTED,BAYES_00, DNS_FROM_OPENWHOIS,FH_DATE_PAST_20XX autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on ethic.thought.org Cc: freebsd-questions@FreeBSD.org Subject: Re: shell script to cap first letter? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2010 20:24:10 -0000 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