From owner-freebsd-questions@FreeBSD.ORG Sun Jul 20 08:17:31 2008 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 D24B5106564A for ; Sun, 20 Jul 2008 08:17:31 +0000 (UTC) (envelope-from kline@thought.org) Received: from aristotle.thought.org (ns1.thought.org [209.180.213.210]) by mx1.freebsd.org (Postfix) with ESMTP id 856B98FC15 for ; Sun, 20 Jul 2008 08:17:31 +0000 (UTC) (envelope-from kline@thought.org) Received: from thought.org (tao.thought.org [10.47.0.250]) (authenticated bits=0) by aristotle.thought.org (8.14.2/8.14.2) with ESMTP id m6K8Hcj4032790; Sun, 20 Jul 2008 01:17:39 -0700 (PDT) (envelope-from kline@thought.org) Received: by thought.org (nbSMTP-1.00) for uid 1002 kline@thought.org; Sun, 20 Jul 2008 01:17:30 -0700 (PDT) Date: Sun, 20 Jul 2008 01:17:30 -0700 From: Gary Kline To: Walt Pawley Message-ID: <20080720081730.GD21826@thought.org> References: <20080720002345.GA9173@thought.org> 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 21++ years of service to the Unix community. X-Spam-Status: No, score=-4.4 required=3.6 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on aristotle.thought.org Cc: FreeBSD Mailing List Subject: Re: How to divide up? 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, 20 Jul 2008 08:17:31 -0000 On Sat, Jul 19, 2008 at 10:23:09PM -0700, Walt Pawley wrote: > At 5:23 PM -0700 7/19/08, Gary Kline wrote: > >Guys, > > > >Is there an easyy way of splitting yp these tags into one-per-line? > >I'm not obcessive [[?, :)]], but for what I've got in mind, the tags and stuff > >would look better to my eyes? ....the outcome of this will go ino a special > >database, not html . > > > >is there some clever perl one-liner that would help me turn > > > >
Realization
> > > >into > > > >
> > > > > >Realization > >
> > I've been using this ... > > #!/usr/bin/perl > # Process HTML data on STDIN into one tag per line form on STDOUT > while (<>) { > s/\r/\n/gs; > s/ s/>/>\n/gs; > s/\n\s*/\n/gs; > s/^\s*//; > print "$_" > } > > ... for quite some time under the name "tag1". It's come in very handy. thanks much, walt --- and everyone else whose ideas helped my shoulder. i have your tag1 in my ~/bin file on my www server it works as adveertised. a note here to rollland smith: i was originally thinking of [[ i tried using ]] tr => tr ">" to \n. Among other things. your idea of using gsed gave me the idea of putting the \n aftter the ">" followed bt a \n. of course this addded in *annnoying* newlines. BUT ``grep -v "^$" axes newlines, so using grit.php, here cut down to spare spamming or wasting resources is the before after: // old, after tidy: # t grit.php
Grit

Patience wears the granite face of wisdom,
discovering the truth of humility and joy.
Hope and faith stand in its silence.
using roland's gsed and a pipe that axes \n's: // fixed, MUCH easier to read: # gsed -e "s/>/>\n/g" Grit

Patience wears the granite face of wisdom,
discovering the truth of humility and joy.
Hope and faith stand in its silence.
I've been meeaning to get around to this for years, and thr time is now. this is just a tiny example of the superiority of the unix smalll-is-beautiful model. [ blah**3] gary > -- > > Walter M. Pawley > Wump Research & Company > 676 River Bend Road, Roseburg, OR 97470 > 541-672-8975 -- Gary Kline kline@thought.org http://www.thought.org Public Service Unix http://jottings.thought.org http://transfinite.thought.org