adding difflines

This commit is contained in:
tengel 2024-03-20 11:28:46 -05:00
parent 66e120baf3
commit 2ce6e1769b

25
shell/difflines.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/sh
#
# SPDX-License-Identifier: MIT
diff --unchanged-line-format="" \
--old-line-format="%dn: %L" \
--new-line-format="%dn: %L" \
"$1" "$2" | sort -n
# This is handy for situations where you need a line-by-line
# comparison of two similar outputs, such as ldd against two
# different libraries to find out if one of them is different
# (extra dependencies). For example:
#
# ldd libsomething.so.old | sort > old.txt
# ldd libsomething.so.new | sort > new.txt
#
# diffl.sh old.txt new.txt
# 1: /usr/lib64/ld-linux-x86-64.so.2 (0x00007f61ba4c7000)
# 1: /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6b96d6b000)
# 2: libc.so.6 => /usr/lib/libc.so.6 (0x00007f61b89f2000)
# 2: libc.so.6 => /usr/lib/libc.so.6 (0x00007f6b95092000)
# 3: libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f61b8376000)
# 3: libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f6b94a16000)
# ...