#!/usr/bin/python3
import re
ptrn = re.compile(r'^\s*user_pref\(([^\)]+)\);').search
unic = set()
with open("user.js", "r") as fi, open("user_nodup.js", "w") as fo:
for s in fi:
m = ptrn(s)
if m:
data = m.group(0)
if data in unic:
print(s, end="") # duplicate
continue
unic.add(data)
fo.write(s)