5

Is it possible to do a fulltext search (or even better regexp) automatically on all websites I have in my bookmark list?

Edit

Is there any other browser where this is possible?

2 Answers 2

1

Maybe you can use the .json backup found inside the ~/.mozilla/firefox/'profile name'/bookmarkbackups/ to search for the websites and then search for expression inside those websites.

1
  • Could you explain this more in detail please?
    – student
    Mar 10, 2011 at 15:50
1

The following script will access the most recent auto-backup of your bookmarks and issues a request for each HTML link.. which is as formatted plain text.. It uses a Terminal web browser called links (it is in the Ubuntu repository) ... It also uses a lightweight text editor called leafpad, so you can modify, add, change the links you want to (it too is in the Upunto repository)...

It doesn't chase links.. it just gives you the page teh link connects to...

The actual captured web-page output is written to a text file which open in gedit (but you can modify it to use grep, sed, awk, vim, less... etc...)

Here is the script: (It probably has some bugs, but it doesn't write to your bookmarks history fille, it only reads them...

#!/bin/bash 
#
# mame: ffhtmllinks
#
# requires:  firefox ...(The source of the bookmarks, using the auto backup list)
#                            TODO: use current list (but where is it?) 
#            leafpad ...(It acts as an editable dialog)
#            links   ...(Terminal web browser, which can write formatted document to stdout)

bname=$(basename $0)
ffdir="$HOME/.mozilla/firefox"
[[ ! -e "$ffdir" ]] && { echo "ERROR: Could not find Firefox config directory:" ; echo "$ffdir" ; exit 1 ; } 
echo  -e "\n# Profile Name\tDirectory\n= ============\t================"
< "$ffdir/profiles.ini" sed -n \
-e "/^\[Profile[0-9]\]$/,/^Path=/{
     :top
         s/^Name=\(.*\)/\1/; t holdname 
         s/^Path=\(.*\)/\1/; t havepath 
         n; b top
     :holdname
         h; n; b top 
     :havepath
         x; G; s/\(.*\)\n\(.*\)/\1:\t\2/p
}" | nl -w 1 -s ' ' > "$ffdir/$bname.names"
cat "$ffdir/$bname.names"
echo  -e "\nType the Name (or line number) of the Profile" \
         "\n         whose bookmarks you want to search"
read name
name="${name%% /}"
name="${name## /}"
<"$ffdir/$bname.names" sed -n "/^\($name .*\)\|\([0-9]\+ $name\)$/ p" > "$ffdir/$bname.sel"     
selct=$(<"$ffdir/$bname.sel" wc -l)
(( selct != 1 )) && { echo "ERROR: Could not find Profile:" ; echo "$name" ; exit 2 ; }

profdir="$ffdir/$(<"$ffdir/$bname.sel" sed -n "s/^[0-9]\+ [^"$'\t'"]\+"$'\t'"\(.*\)$/\1/p")"
bbakdir="$profdir/bookmarkbackups"     
[[ ! -e "$profdir"  ]] && { echo "ERROR: Could not find Firefox Profile directory:" ; echo "$profdir" ; exit 3 ; } 
[[ ! -e "$bbakdir"  ]] && { echo "ERROR: Could not find Firefox Bookmark Backup directory:" ; echo "S$bbakdir" ; exit 4 ; }
bbakjson="$(for f in "$bbakdir/bookmarks"* ; do echo "$f" ; done | sed -n \$p)"
[[ ! -e "$bbakjson" ]] && { echo "ERROR: Could not find Firefox Bookmark Backup .json file:" ; echo "  $bbakjson" ; exit 4 ; }
bbakhtml="$ffdir/$bname.bbakhtml"     
<"$bbakjson" sed -n "s/,\"uri\":\"http/\n"$'\x01'===$'\x01'"http/gp" \
            |sed -n "s/^"$'\x01'"==="$'\x01'"\([^"\""]\+\)\".*/\n\1\n/p" \
            |sed "/^$/ d" \
            >"$bbakhtml"
echo "===="
echo "INFO: About to open the list of bookmark links in a text editor (leafpad)..."
echo "      You can modify, add or remove links as you like..."
echo "      It is only a temporary file, so you won't loose your bookmarks..."
echo "  NB: You must actually EXIT 'leafpad' before this process can proceed."
echo
echo -n "Press Enter to open the bookmarks list in 'leafpad'... "
read x
echo
div="####################################################################################"     
pagedump="$ffdir/$bname.bbakdump" ; cp /dev/null "$pagedump"
linkcnt=$(<"$bbakhtml" wc -l); linklnb=1
<"$bbakhtml" leafpad 2>/dev/null
echo "======================================="
( while IFS= read -r link ; do
  echo -e "\n\n$div\n$div\n$div\n# \n# Link $((linklnb++)) of $linkcnt\n# \n"
  links -dump "$link"  
done <"$bbakhtml" ) |tee >( sed -n p >>"$pagedump" ) | sed -n p
wait 2 # TODO need a wait loop here for asynchronous process-substitution (sleep will have to do for now)
gedit "$pagedump"
exit
#

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .