in reply to Re: search and using first letter of words on a line
in thread search and using first letter of words on a line
<quote>I'm having trouble groking how this helps:
<font size="-1><a href="#PINPAORToc" name="PINPAORTxt" style=text-decoration:none">... The font size leaves me puzzled on two counts:</quote>
I really appreciate the help and actually I have some things to look at to help makes things leaner for sure. But my question, the only thing I really need answered ATM is:
How can I extract the first letter from each word in a string and join them together?
I have been searching and it looks like perhaps using perl I need to use the substr, split, and join functions, so if anyone might be able to provide some sort of example I would be grateful.
It seems like it might be a similar request to extracting the first letter of names in a generated list or file?
I am uncertain if a sed example might help but something I have tried in sed is:
sed -ri 's/<b>([A-Za-z])([A-Za-z:,]{0,20})[ ]{0,1}([A-Za-z]{0,1})[ ]{0,1}([A-Za-z:,]{0,20})[ ]{0,1}([A-Za-z]{0,1})[ ]{0,1}([A-Za-z:,]{0,20})[ ]{0,1}([A-Za-z]{0,1})(.*)<\/b>/<font size="-1"><a href="#\1\3\5\7Toc" name="\1\3\5\7Txt" style="text-decoration:none">\1 \2 \3 \4 \5 \6 \7 \8<\/a><\/font><br>/' 1.html
which is getting a little unruly not to mention I am limited to capturing on the first letters of the first four words in the string because sed only has nine memory buffers to recall from, so I think by turning to perl I will give myself a lot more options to do what I want.
cheers nap
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: search and using first letter of words on a line
by ww (Archbishop) on Sep 23, 2011 at 10:39 UTC |