perl/bash question - html link out of text

2010-03-07 Thread Vadkan Jozsef
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


can some perl/bash gods help me? :)


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1267981676.2365.83.ca...@ubuntu



Re: perl/bash question - html link out of text

2010-03-07 Thread Kumar Appaiah
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://[^ 
\$]+).*,\1a href=\\2\\2/a,'

HTH.

Kumar
-- 
Whoa...I did a 'zcat /vmlinuz  /dev/audio' and I think I heard God...
-- mikecd on #Linux


signature.asc
Description: Digital signature


Re: perl/bash question - html link out of text

2010-03-07 Thread Kumar Appaiah
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://[^ 
 \$]+).*,\1a href=\\2\\2/a,'

Rather:

echo test string http://somewhere.uk/ test | sed -r 's,(.*)(http://[^ 
\$]+)(.*),\1a href=\\2\\2/a\3,'

Kumar
-- 
Win95 is not a virus; a virus does something.
-- unknown source


signature.asc
Description: Digital signature


Re: perl/bash question - html link out of text

2010-03-07 Thread Boyd Stephen Smith Jr.
On Sunday 07 March 2010 11:07:56 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

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

maybe?
-- 
Boyd Stephen Smith Jr.   ,= ,-_-. =.
b...@iguanasuicide.net  ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/\_/


signature.asc
Description: This is a digitally signed message part.