Firefox书签add_date

时间:2014-09-26 09:02:16

标签: date firefox browser bookmarks

firefox导出书签的一个问题。

如何阅读此日期:ADD_DATE =" 1375088003"?我认为这是用户将新网站添加到书签的日期,但是如何读取所有字符串?年,日,月在哪里?

1 个答案:

答案 0 :(得分:0)

Here's what I do. I export bookmarks from my browser. Assume the result file is called "bookmarks.html". I have a one-line executable script that takes a file as input, and creates another file with many long fields stripped. The one-liner I call "icon.sed" contains this:

sed 's/ICON=\"[^\"]*\"//' | sed 's/ICON_URI=\"[^\"]*\"//' | \
sed 's/LAST_CHARSET=\"[^\"]*\"//' | sed 's/HREF=\"[^\"]*\"//'| \
tr -s ' '

I use it like this:

~/icon.sed <bookmarks.html >newbook.txt

I have another script that takes a mm/dd/ccyy parameter, and returns the Epoch time for that date. That executable script is called "epoch.sh":

#!/bin/sh
if [ -z "$1" ]; then echo "You must supply a date"
else date -j -f "%m/%d/%Y" "$1" "+%s"; fi
exit 0

Choose a date you're looking for, and send it through "epoch.sh", such as: ~/epoch.sh 10/30/2015 which outputs this: 1446246082 .

You can then grep your newbook.txt file looking for either ADD_DATE or LAST_MODIFIED date which begins with the first four digits: 1446

grep 'LAST_MODIFIED="1446' newbook.txt

Also, use epoch.sh to get a pair of epoch times for start and stop dates so you can bracket your results by doing multiple greps over the range, using just the first four digits of each epoch time.