On Sun, Mar 07, 2010 at 11:12:39AM -0600, Kumar Appaiah wrote: > On Sun, Mar 07, 2010 at 06:07:56PM +0100, Vadkan Jozsef wrote: > > 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 > > How about: > > echo "test string http://somewhere.uk/ test" | sed -r 's,(.*)(http://[^ \"$]+).*,\1<a href=\"\2\">\2</a>,' Rather: echo "test string http://somewhere.uk/ test" | sed -r 's,(.*)(http://[^ \"$]+)(.*),\1<a href=\"\2\">\2</a>\3,' Kumar -- Win95 is not a virus; a virus does something. -- unknown source
Attachment:
signature.asc
Description: Digital signature