diff while ignoring patterns within a line, but not the entire line diff while ignoring patterns within a line, but not the entire line unix unix

diff while ignoring patterns within a line, but not the entire line


You can use temporary streams to avoid file creation and cleanup, syntax is following:

$ diff <(command with output) <(other command with output)

In your case:

diff <(cat f1 | sed -e's/^\[....-..-..\]//') <(cat f2 | sed -e's/^\[....-..-..\]//')

Hope this helps.


It isn't exactly what you are looking for since I'm not sure how to retain the dates, but this does solve a couple of your issues:

diff -u --label=file1 <(sed 's/^\[....-..-..\]//' file1) --label=file2 <(sed 's/^\[....-..-..\]//' file2)

Output:

--- file1+++ file2@@ -1,2 +1,2 @@- Some random text foo+ Some random text bar  More output here