naphelge has asked for the wisdom of the Perl Monks concerning the following question:
hey gang,
I want to search strings of text in an html file and on match (regex) read (buffer) the first letter of each word in the search field discarding the rest and making the first letters available so I can substitute them on the line something like:
</p><p><b><font face="Garamond" size="5">Part II: Nietzsche's Project, An Overall Review</b></center>
I would like to end up with:
<p><font size="-1><a href="#PINPAORToc" name="PINPAORTxt" style=text-decoration:none">Part II: Nietzsche's Project, An Overall Review</a></font><br>
I need to re-format webpages to be as small (in size) as possible so I can upload them to my phone for easy reading while I am on the bus each day. I also need logical links in the document for easy navigation. So anyways, I have been making due with sed, but I have hit a wall with what I would like to do and what sed wants to do. For the example above I can hack it in sed, but sed only has 9 buffers and no kewl functions to make life easier.
sSo I hope the above example makes sense as I am sure there is an easier perl oneliner than sed oneliner that can do it.
cheers, nap
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: search and using first letter of words on a line
by aaron_baugher (Curate) on Sep 22, 2011 at 06:34 UTC | |
by Anonymous Monk on Sep 22, 2011 at 12:10 UTC | |
by aaron_baugher (Curate) on Sep 22, 2011 at 20:21 UTC | |
|
Re: search and using first letter of words on a line
by ww (Archbishop) on Sep 22, 2011 at 12:52 UTC | |
by Anonymous Monk on Sep 23, 2011 at 02:51 UTC | |
by ww (Archbishop) on Sep 23, 2011 at 10:39 UTC |