changeset 323:dc7847750384 trim

working on comparing miss key with miss url
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Fri, 23 Jan 2026 15:50:15 +0000
parents 783d65d43fb0
children 85612f32e9b6
files lib/python/cc/lmh/miss_bogons.py
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/python/cc/lmh/miss_bogons.py	Fri Jan 23 15:50:15 2026 +0000
@@ -0,0 +1,23 @@
+#!/usr/bin/python3
+'''Compare the two columns of output from
+   cdb_one /tmp/hst/%d%d_a/shrunk.cdb 24 25 20230922103943 2>/tmp/hst/2424/cdx-00{}_misses
+   E.g.
+  b'4827://188.246.103.10/klubicko/?tab=events' b'10,103,246,188)/klubicko?tab=events'
+  b'4312://5.160.123.10/' b'10,123,160,5)/'
+'''
+import sys, re
+kPat = re.compile("b'([0-9]*s?://)([^/]*)('$|/(.*)'$)")
+kuPat = re.compile("^([^/]*)/?($|([?].*)$)")
+
+with open(sys.argv[1], 'r') as f:
+  for l in f:
+    (key, url) = l.rstrip().split(' ')
+    if (m:=kPat.match(key)):
+      (k_d,k_h,_,k_u) = m.groups()
+    else:
+      print("bad key |%s|"%key,file=sys.stderr)
+      exit(1)
+    #print(key,"|%s|%s|%s|"%(k_d,k_h,k_u))
+    print(kuPat.sub('\\1\\2', k_u))
+
+