Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    [Help Request] Extracting uri's from mozilla bookmarks backup

    Hello Linux Forums,
    I recently made the switch from Windows 7 to Ubuntu 10.10. I'm trying to get used to doing some scripting and so I'm trying to extract uri's from firefox backup file.

    I can't post what the file contains because I'm not allowed to post urls without making 15 posts first.
    I suppose the relevant information is that they begin with http and end at the next "}".

    I think I need to pipe cat into grep and then use cut to select the fields.

    Something like:

    cat bookmarks.json | grep "http" | cut -d } -f 1
    needless to say this doesn't work.

    Can anyone point me in the right direction?

    Much appreciated.

  2. #2
    Linux Newbie raghaven.kumar's Avatar
    Join Date
    Mar 2008
    Bangalore, India
    Your syntax is right!
    But i suppose the bookmark backup is a single line file, thats why grep doesnt work.

    You can try,
    cat bookmarks.json | sed 's/\,/\n/g' | grep http | cut -d\" -f4 > new.json
    Here the commas are converted to newline and the lines with http are taken and just urls filtered.

    Let me know if it went well

  3. #3
    Worked perfect thanks!!

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts