perl or bash question ["convert strings in a txt to html links"]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How can I do that in bash or perl, that I have a txt file, e.g.:

$cat file.txt
Hi, this is the content of the txt file, that contains links like this:
http://www.somewhere.it/, and it could contain: http://somewhere.com,
etc..
This is the second line, that doesn't contains links..
..
This is the XYZ line, that contains a link: http://www.somewhere.net
$


...ok.. so how could I make a regexp for this?

Turning:

http://website.org
http://www.website.org

to this:

<a href=http://website.org>http://website.org</a>
<a href=http://www.website.org>http://www.website.org</a>

The solution would be:

sed 'SOMEMAGIC' file.txt > file.html
or
perl 'SOMEBIGMAGIC' file.txt > file.html

:D

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux