31 lines
444 B
Awk
31 lines
444 B
Awk
#!/usr/bin/env -S awk -f
|
|
# Usage: $0 file.abc > filtered_file.abc
|
|
BEGIN {
|
|
OFS = FS = "\t"
|
|
}
|
|
{
|
|
a=$1
|
|
b=$2
|
|
c=$3
|
|
if (a > b) {
|
|
tmp=a
|
|
a=b
|
|
b=tmp
|
|
}
|
|
if (!(b in graph[a])) {
|
|
graph[a][b] = c
|
|
} else {
|
|
if (graph[a][b] < c) {
|
|
graph[a][b] = c
|
|
}
|
|
}
|
|
}
|
|
|
|
END {
|
|
for (a in graph) {
|
|
for (b in graph[a]) {
|
|
print a, b, graph[a][b]
|
|
}
|
|
}
|
|
}
|