Monday, March 16, 2020

Handy UNIX diff: Exclusive match

Super handy tool for selectively removing serial contents from a text file:

#!/bin/bash
# xdiff <new_file> <old_file>
# Exclusive diff - just show what's different from the first file
#       example: xdiff SYMBOLS.txt remove_symbols.txt >SYMBOLS2.out
diff -u $1 $2 | grep '^-[^-]' | sed 's/^-//'





No comments:

Post a Comment