Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-19-2014, 01:43 PM   #1
Registered: Mar 2009
Distribution: CentOS 6.5 / 7
Posts: 119

Rep: Reputation: 1
ack/sed, locate website address(s) in file and format in bbcode url

ok, this is going to be a real easy answer for somebody. I just know it.

First the basics: created a script that 1.)ran an SQL query and output to an HTML file. Then 2) ran it though another script that made it suitable to post on a forum like this one and lastly 3) print it out so it can be copied and pasted. Very simple stuff:

(sql query ->
sed -i.bak s/\</\[/g
sed -i.bak s/\>/\]/g
sed -i.bak "s/TABLE[ ]BORDER=1/Table=\"class: grid, width: 100\%, align: center\"/g"
Something makes me think I got some help from here on it, forgot a \ or something...

Anyway, moving on...

The script works flawlessly. It turns an HTML table into BBCode table. However, there is an issue. The database contains some web addresses ( and I would like to make them clickable in my bbcode table. I know there is a way to do this. I can find "HTTP://" because all addresses start with that, but they are all variable lengths.

Not to mention, the bbcode for url's goes something like this:
[ URL="" ]text here[ /URL]
(had to put spaces in to make it show up, even in code tags)
So not only do I have to wrap the address within the tags, I will also need to insert a text block between them.

Any suggestions?

Last edited by thealmightyos; 11-19-2014 at 01:48 PM.
Old 11-26-2014, 04:41 AM   #2
Senior Member
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,416

Rep: Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541
If you're going to paste things in to an edit box in a forum then you'll find that most forums are set up to do the detection of the urls and turn them in to links automatically on the forum side.
Old 05-05-2015, 11:37 AM   #3
Registered: Mar 2009
Distribution: CentOS 6.5 / 7
Posts: 119

Original Poster
Rep: Reputation: 1
Fortunately I am not working on that project anymore. It was a headache anyway. Thank you for the assistance. Thread can be closed


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace IP address string in a file using sed finekevin Linux - Newbie 2 01-18-2012 08:16 PM
[SOLVED] [Help] format text file for import into SQL table (with sed or similar) totaluser Linux - Newbie 3 11-05-2011 04:57 PM
Sed, and how to get the file name from an URL the who Programming 2 06-08-2004 02:20 PM
how does a brower get URL address info when the website is hiding it? sirpelidor Programming 3 12-05-2003 10:33 PM
convert html file to latex format using sed? BigHeadDog Linux - Newbie 2 12-02-2003 12:30 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:19 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration