zeek/testing/scripts/diff-remove-abspath
Christian Kreibich 3984d99a86 Make diff-remove-abspath canonifier match on non-whitespace paths only
This avoids swallowing multiple separate paths separated by unrelated
content into one substitution, like here:

orig_p=59856<...>/tcp] -> orig_p=59856/tcp, resp_h=192.150.187.43, resp_p=80/tcp]
2020-12-06 18:19:06 -08:00

12 lines
216 B
Bash
Executable file

#! /usr/bin/env bash
#
# Replace absolute paths with the basename.
if [ `uname` == "Linux" ]; then
sed="sed -r"
else
sed="sed -E"
fi
$sed 's#/+#/#g' | \
$sed 's#/([^\t :/]{1,}/){1,}([^\t :/]{1,})#<...>/\2#g'