Loki Harfagr <l0...@thedarkdesign.free.fr.INVALID> wrote in
news:pan.2013.01...@thedarkdesign.free.fr.INVALID:
> Sat, 19 Jan 2013 20:03:19 +0000, buck did cat¶ÿ:
>
>> For google, here's what I settled for:
>>
>> cat $
i.br\
>> | sed -e s/`echo '^\x3f\x20'`/"\• "/g\
>> | sed -e s/`echo '\x20\x3f\x20'`/" \⇒ "/g\
>> | sed -e s/`echo -en "\002"`/"\<CENTER\>"/g\
>> | sed -e s/`echo -en "\003"`/"\<\/CENTER\>"/g\
>> | sed -e s/`echo -en "\017""\027"`/"\<\/FONT\>"/g\
>> | sed -e s/`echo -en "\026""\016"`/"\<FONT COLOR='green'\>"/g\
>> | sed -e s/`echo -en "\016"`/"\<FONT COLOR='red'\>"/g\
>> | sed -e s/`echo -en "\026"`/"\<FONT COLOR='blue'\>"/g\
>> | sed -e s/`echo -en "\017"`/"\<\/FONT\>"/g\
>> | sed -e s/`echo -en "\027"`/"\<\/FONT\>"/g\ > $i.sed
>
> There are a few points I don't understand in your reply :D)
> Let's try just the simple ones ;-)
> 1 - your say "For google" , what is Google doing there?
google is here because searching newsgroups containing "os.linux" has
provided me with many solutions. It has also pissed me off when the OP
fails to post the solution, so I posted this solution.
> 2 - why the echo expansion since you're in a cat and have a \xnn?
When "echo" is absent, the file output by sed is unchanged. I've no idea
why; don't care because echo makes sed work for me.
> 3 - why the cascading pipes instead of joint sed commands?
The cascade was done as I discovered stuff in the txt source that was not
properly rendered in html. Easier to test when cascaded. Never bothered
to join. In fact. the file output in this portion of the script is run
through sed a second time to convert some octal to decimal for html; eg
0205 to …. That sed is also cascaded because I found 8 characters
incorrectly rendered, and not all of them are pretty when converted from
octal to decimal - so I picked something I liked better; eg 0267 to &#
149; rather than to ·.
>> Loki, I find it easier to edit HTML when the tags are upper case.
>
> if the resulting HTML is FYEO that's OK but if that's supposed to
> go online at some time I think you know it is deprecated (and some
> expressions as well, ex: "<center>") and since then you'll have to
> tidy it up why not taking it easier and directly write your parser
> in gawk? (eventually using a parse rules file and a simple parser
> engine)
I got tired of editing the txt files to replace the question mark, so
fixed the 5 bash scripts that convert txt to html. The html is online
and has been for years. It is a knowledge base and gets added to weekly.
At this time, there are 6006 entries in that KB. I don't give a damn
about deprecated so long as all browsers correctly render the pages.
When that stops happening, I'll cross that bridge.
Rather than gawk, perl seems more elegant, but sed + bash works...
Thank you for your time. I always enjoy your posts and often learn from
them.
--
buck