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
> >
> ><CENTER><FONT face="Times" size="3"><FONT color="#333366">Realization<BR>
> >
> >into
> >
> ><CENTER>
> ><FONT face="Times" size="3">
> ><FONT color="#333366">
> >Realization
> ><BR>
> 
> 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/</\n</gs;
>       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
<CENTER><FONT face="Times" size="3"><FONT color="#333366">Grit
<BR><BR>
Patience wears the granite face of wisdom,<BR>
discovering the truth of humility and joy.<BR>
Hope and faith stand in its silence.<BR>
</FONT></FONT></CENTER>

        using roland's gsed and a pipe that axes \n's:

// fixed, MUCH easier to read:
# gsed -e "s/>/>\n/g" <grit.php| grep -v "^$"
<CENTER>
<FONT face="Times" size="3">
<FONT color="#333366">
Grit
<BR>
<BR>
Patience wears the granite face of wisdom,<BR>
discovering the truth of humility and joy.<BR>
Hope and faith stand in its silence.<BR>
</FONT>
</FONT>
</CENTER>

        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 <[EMAIL PROTECTED]>
> Wump Research & Company
> 676 River Bend Road, Roseburg, OR 97470
>          541-672-8975

-- 
 Gary Kline  [EMAIL PROTECTED]  http://www.thought.org  Public Service Unix
        http://jottings.thought.org   http://transfinite.thought.org


_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to