home
/
code
/
dups.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b839d58
)
Improve names in illustrative script
author
Siraaj Khandkar
<siraaj@khandkar.net>
Thu, 15 Nov 2018 01:23:20 +0000
(20:23 -0500)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Thu, 15 Nov 2018 01:23:20 +0000
(20:23 -0500)
README.md
patch
|
blob
|
blame
|
history
diff --git
a/README.md
b/README.md
index
a6e6c54
..
f273b75
100644
(file)
--- a/
README.md
+++ b/
README.md
@@
-6,7
+6,7
@@
having the same MD5 hash digest.
It is roughly equivalent to the following one-liner:
```sh
It is roughly equivalent to the following one-liner:
```sh
-find . -type f -exec md5sum '{}' \; | awk '{
paths[$1, ++cnt[$1]] = $2} END {for (path in cnt) {n = cnt[path]; if (n > 1) {print(path, n); for (i=1; i<=n; i++) {print(" ", paths[path, i])
} } } }'
+find . -type f -exec md5sum '{}' \; | awk '{
digest = $1; path = $2; paths[digest, ++count[digest]] = path} END {for (digest in count) {n = count[digest]; if (n > 1) {print(digest, n); for (i=1; i<=n; i++) {print " ", paths[digest, i]
} } } }'
```
which, when indented, looks like:
```
which, when indented, looks like:
@@
-14,15
+14,18
@@
which, when indented, looks like:
find . -type f -exec md5sum '{}' \; \
| awk '
{
find . -type f -exec md5sum '{}' \; \
| awk '
{
- paths[$1, ++cnt[$1]] = $2
+ digest = $1
+ path = $2
+ paths[digest, ++count[digest]] = path
}
}
+
END {
END {
- for (
path in c
nt) {
- n = c
nt[path
]
+ for (
digest in cou
nt) {
+ n = c
ount[digest
]
if (n > 1) {
if (n > 1) {
- print(
path
, n)
+ print(
digest
, n)
for (i=1; i<=n; i++) {
for (i=1; i<=n; i++) {
- print
(" ", paths[path, i])
+ print
" ", paths[digest, i]
}
}
}
}
}
}
This page took
0.023877 seconds
and
4
git commands to generate.