aboutsummaryrefslogtreecommitdiff
path: root/home/john/.dillo/bm
blob: cc26f23b1f915324191bf651c3ebbea48323af40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

# bm -- re-arrange dillo bookmarks

awk -F: '
	/^s0 / {
		sub(/^s0 /, "")
		new[i++] = $0
		next
	}
	{
		print
	}
	/^:/ {
		sub(/^ */, "", $3)
		section[$3] = $2
	}
	END {
		if(section["Archive"]==""){
			print "error: section Archive not found" > "/dev/stderr"
			exit 1
		}
		for(j = 0; j<i; j++)
			print section["Archive"] " " new[j]
	}
' ~/.dillo/bm.txt > ~/.dillo/bm.tmp &&
mv ~/.dillo/bm.tmp ~/.dillo/bm.txt