I have a directory sub1
with the following files:
$ wc -l *
5 file1.csv
5 file3.csv
1 file4.csv
In sub2
, I have the following:
$ wc -l *
5 file1.csv
5 file2.csv
1 file3.csv
5 file4.csv
1 file5.csv
In the first directory, I might have files with added lines, which then go to the second dir. In this example, I might need to update file3
in sub2
.
How do I get a list of the files with differences?
I did some tests with diff
and grep
, but it doesn't work because the directories have different files (and hence the lines are different):
~/dir1/$ wc -l >> wc.luis
~/dir1/$ wc -l * | awk '{ gsub(/\/home.*dir1\//,""); print $0 }'
| diff --side-by-side wc.luis -
| grep \|
Ideally, I would get a list like this:
5 file3.csv | 1 file3.csv
1 file4.csv | 5 file4.csv
Any help is appreciated!
Notes:
I cannot check on the date, because all files were updated, with or without changes.
Sometimes the newest files lack some lines, for which reason I cannot just take the bigger one.
diff -r sub1 sub2
or am I missing something? – Stephen Harris Sep 5 '16 at 16:35diff -r sub1 sub2 | grep ^diff
will just report on the filenames that are present in both but different. – Stephen Harris Sep 5 '16 at 16:47