comparison repair.py @ 63:721bd7a04efb

bigger regexp building
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Thu, 14 Dec 2023 10:16:28 +0000
parents c82a8743fd48
children fff2fa031ed7
comparison
equal deleted inserted replaced
62:c82a8743fd48 63:721bd7a04efb
100 method: change "ht" to "nnml+ht", flag anything else 100 method: change "ht" to "nnml+ht", flag anything else
101 params: TBD 101 params: TBD
102 102
103 Comparison tool: 103 Comparison tool:
104 104
105 export P='\(nil\|(\(\([0-9]\+\|([^)]*)\) \?\)*)\)'
106 paste <(cat shared) <(fgrep -f shared mail/alist.fixed | sed 's/ \([0-9]\) '"$P $P/ \1 \2 \5 /g" | cut -f 3) <(fgrep -f shared gnus/alist.fixed | sed 's/ \([0-9]\) '"$P $P/ \1 \2 \5 /g" | cut -f 3) | { IFS=' ' ; while read gn g m; do if [ "$g" != "$m" ]; then printf "=----%s------\n%s\n%s\n" "$gn" "$g" "$m"; fi; done ; } | less 105 paste <(cat shared) <(fgrep -f shared mail/alist.fixed | sed 's/ \([0-9]\) '"$P $P/ \1 \2 \5 /g" | cut -f 3) <(fgrep -f shared gnus/alist.fixed | sed 's/ \([0-9]\) '"$P $P/ \1 \2 \5 /g" | cut -f 3) | { IFS=' ' ; while read gn g m; do if [ "$g" != "$m" ]; then printf "=----%s------\n%s\n%s\n" "$gn" "$g" "$m"; fi; done ; } | less
107 106
108 Watch out for tabs! 107 Watch out for tabs!
109 To look for overlap, change 2nd \n in printf to \t 108 To look for overlap, change 2nd \n in printf to \t
110 109
110 export T=$'\t'
111 export B1="(\(\([-0-9a-z]\+\|([^)]*)\) \?\)*)"
112 export P1="\(nil\|$B1\)"
113 export P2="\(nil\|\((\($B1 \?\)*)\)\)"
114 export M='\("[^"]*"\|(nndraft "")\)'
115
116 fgrep -f shared mail/alist.fixed | sed 's/ \([0-9]\) '"$P1 $P2 / \1 \2 \5 /;s/\(.*${T}.*${T}.*${T}\)$M /\1\2${T}/"
111 ''' 117 '''