-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathtrace62list.sh
More file actions
executable file
·26 lines (21 loc) · 869 Bytes
/
trace62list.sh
File metadata and controls
executable file
·26 lines (21 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
REMOVE="tr X X"
test "$1" = "-r" && { REMOVE='grep -v "?"' ; shift ; }
test -z "$1" -o '!' -e "$1" && {
echo "Syntax: $0 trace6_output_file [skip-cnt] > foo.out"
echo "Prepares a trace6 output file for the network topology map generation tool"
echo "(create_network_map.sh). If skip-cnt is defined, the amount of initial hops are skipped"
# echo "If the -r option is defined, all ??? entries are removed"
exit 1
}
SKIP=""
FILE="$1"
test -n "$2" && SKIP=$2
{
test -z "$SKIP" && grep -E '^ *[0-9]+: ' "$FILE"
test -z "$SKIP" || {
LINES=`grep -E '^ *[0-9]+: ' "$FILE" | wc -l`
DUMP=`expr $LINES - $SKIP`
test "$DUMP" -gt 0 && grep -E '^ *[0-9]+: ' "$FILE" | tail -n $DUMP
}
} | tr '\t' ' ' | sed 's/ *\[.*//' | awk '{print$2" "$3}' | sed 's/ ()//' | tr '\n' '#' | sed 's/[??? #]*??? #$/#/' | sed 's/!!! *#$/#/' | tr '#' '\n'