|
|
 |
Re: FN-FORUM: regex ?
date posted 19th August 2005 17:25
Ian Robertson wrote:
> Hi All,
>
> How do I get the first char of a word using a sed style substitute ?
>
> Odd thing to want to do ( and I know it should be trivial ) - am trying to
> write some templates for the vim - tskeleton set and want to generate the
> access key letter for a form element when the ident for the element is given.
>
> The tskeleton scripts provide an s/ / / modifier for input strings.
>
> BTW anyone else using vim & tskeleton ?
>
> Cheers
> Ian
>
>
echo "this really works" | sed -e 's/\s*\(\S\)\S*/\1 /g'
This gets the first character of every word. More precisely it displays
(separated by a space) the first of every group of non-space characters.
A
|
 |
|