From 3ed7425efe5ad0bec184897c3eaee6c88d84554e Mon Sep 17 00:00:00 2001 From: heqnx Date: Mon, 12 May 2025 20:20:51 +0300 Subject: added diff-to-file.sh --- diff-to-file.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 diff-to-file.sh diff --git a/diff-to-file.sh b/diff-to-file.sh new file mode 100644 index 0000000..077498a --- /dev/null +++ b/diff-to-file.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if test "${#}" -ne 2; then + printf "%s\n" \ + "compare two files and output the difference" \ + "usage: $(basename $0) " + exit 1 +fi + +if ! command -v comm &>/dev/null; then + printf "%s\n" "comm not found" + exit 1 +fi + +output="${1}__not_in__${2}" +comm -23 <(sort "${1}") <(sort "${2}") > "${output}" +printf "%s\n" "results of what is in ${1} and not in ${2} in ${output}" -- cgit v1.2.3