Moved to Linux--Anyway to save my bookmarks?

Nighthawk69

Golden Member
Oct 10, 2000
1,113
0
0
Hi there...

I just moved from Windows XP to Linux and I backed up all of my Favorites from MSIE 6.0 and I was wondering if there was anyway that I could somehome import these into Linux (I'm using Konqueror right now) so that I have all of my links?

Thanks!! :)
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
There are IE->Netscape (i.e. one big html file) converters that work with Mozilla on all platforms. No idea how Konq stores bookmarks though.
 

mgpaulus

Golden Member
Dec 19, 2000
1,112
0
0
Well, right off the top of my head, I think you could write a quick script using sed that would create the file for you:


---------- script begins ---------------------

for i in `find . -type f`
do
url=`sed -ne '^URL=\(.*\)/\1/p'`
echo "<a href=\"$url\">$file<\/a>" >> bookmarks.html
done


-------- script ends -------------------------

That is what I would use to start with. It might or might not work. You would need to run the script in the root of your saved Favorites directory....
 

Nighthawk69

Golden Member
Oct 10, 2000
1,113
0
0
Thanks guys!

mgpaulus: Could you explain how to use this script in detail? I'm still learning Linux and this is something I don't know how to do yet... :)
 

mgpaulus

Golden Member
Dec 19, 2000
1,112
0
0
First thing you are going to need to do is to learn vi. You will curse it until you learn it, then you will hate all other editors. Anyway, there is an Oreilly book called 'Learning VI' which is handy. Or, you can go to vim's homepage, and poke around until you find their tutorial. It may be bundled with one of the vim packages, so I can't tell you exactly where to look. But, the tutorial takes about 20-30 minutes, and gives you some hands on experience using vi.
(I know, there are probably other editors out there you can find, like joe, pico, etc, etc), BUT.... If you want to be able to work on ANY unix system, you should at least know HOW to get around in vi, because that is pretty much the ONLY editor that transcends all flavors of unix)

So, once you have an editor, you can now edit a script:
vi myscript, and start typing in the following:

# Look for all files of any type, starting with my current location
# the grave (`) tells the shell to run this command and give the results
# back to the shell
# the find . - type f is a standard way to find all files of type f, and return them.
# then process each one of them one by one
for i in `find . -type f`
# start of processing block
do
# Now, get the string out of each file that starts with URL= and store
# it in a variable called url
# I forgot the trailing $i in the original example, to tell sed which file
# to operate on.
url=`sed -ne '^URL=\(.*\)/\1/p'`$i
# Now, let's create a file called bookmarks.html, and put the URL and it's
# associated name into the file.
# $url = the url from the file
# $i is the name of the file, which is how the link was listed in the Favorites list
# <a href="http:.....>Link Name</a> is standard html
echo "<a href=\"$url\">$file<\/a>" >> bookmarks.html
# end the block for a given file instance
done

Once you have the script created, then you need to make it executable. In unix land, this is done
via the chmod command: chmod +x myscript

Then, to execute it, cd to the directory where your Favorites are stored, and run the script:
/directory/where/myscript/is/located/myscript

And hopefully a bookmarks.html will appear. If there are typos/errors, then some level of debugging needs to occur.

If you have further questions, I would suggest that you learn about another VERY important
unix feature, which is the man pages. man shell will tell you about the for.... construct
man sed will tell you all about sed.

If you still don't understand, then post again.....

 

Nighthawk69

Golden Member
Oct 10, 2000
1,113
0
0
OK, thanks a lot for that great mini-HOWTO!

One problem though so far: After CHMOD'ing the script and trying to run it, I get an error that says "bash: myscript: command not found."

I'm not sure what the problem is...

Thanks!
 

Chaotic42

Lifer
Jun 15, 2001
34,764
1,937
126
Originally posted by: mgpaulus
First thing you are going to need to do is to learn vi. You will curse it until you learn it, then you will hate all other editors. Anyway, there is an Oreilly book called 'Learning VI' which is handy. Or, you can go to vim's homepage, and poke around until you find their tutorial. It may be bundled with one of the vim packages, so I can't tell you exactly where to look. But, the tutorial takes about 20-30 minutes, and gives you some hands on experience using vi.

Yes, vi is important to learn. I don't use it exclusively (I use jed), but it does transcend many systems.




 

ScottMac

Moderator<br>Networking<br>Elite member
Mar 19, 2001
5,471
2
0
If you sign with Yahoo (myYahoo) they have a bookmark transfer (to a Yahoo toolbar). From there, you can DOWNLOAD your bookmarks fromYahoo into your browser....I'm pretty sure they support Linux / IE / Netscape ...maybe more.

They might even import the Yahoo toolbar to your Linux browser (and any other portables or machines you work on) so you have the same bookmark across all the machines you use.

Check it out.

Scott
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
One problem though so far: After CHMOD'ing the script and trying to run it, I get an error that says "bash: myscript: command not found."

Linux doesn't work like Windows, the current directory isn't in your search path. type ./myscript and it'll run.
 

Nighthawk69

Golden Member
Oct 10, 2000
1,113
0
0
OK, that made the script run, but now I have a new problem:

It creates the file and makes a bunch of links in it, but the link's have no names, but the URL's seem to be correct. SED also returns a bunch of a same error: "sed: -e expression #1, char 1: Unkown command: ``^'' "

Any ideas?

Thanks!!!!
 

mgpaulus

Golden Member
Dec 19, 2000
1,112
0
0
Yep, I know exactly what the problem is. My fat fingers :)

Try this line:
url=`sed -ne 's/^URL=\(.*\)/\1/p'`$i