perl/bash question - html link out of text

Florian Diesch diesch at spamfence.net
Sun Mar 7 18:02:19 UTC 2010


Vadkan Jozsef <jozsi.avadkan at gmail.com> writes:

> I don't know how to modify the:
>
> sed -r 's,.*(http://[^ \"$]+).*,<a href=\"\1\">\1</a>,'
>
> command, to not just:
> $ echo "test string http://somewhere.uk/ test" | sed -r 's,.*(http://[^
> \"$]+).*,<a href=\"\1\">\1</a>,'
> <a href="http://somewhere.uk/">http://somewhere.uk/</a>
>
> rather output this:
> test string <a href="http://somewhere.uk/">http://somewhere.uk/</a> test

sed -r 's,(http://[^\"$ ]+),<a href=\"\1\">\1</a>,'



   Florian
-- 
<http://www.florian-diesch.de/grundgesetz.html>




More information about the ubuntu-users mailing list