diff is designed to detect insertions and deletions of lines, not just simple changes of lines, and that format would leave a lot desired for that; what you want isn't diff, exactly.
I don't understand where your output comes from, either. You seem to be showing the string 'diff' exists in both files when it does not...
The string "diff" does exist in both files (I created the files to show an example). I realize that diff has the ability to provide differences for the purpose of merging files, I am not interested in that. I am creating a report from output of diff and am filtering out the additional information that diff provides (e.g. ---, +++, @@). The report would be much more useful if the differences were shown as one line at a time instead of being grouped. If there is another command/tool that I can use instead of diff for that I am open to it. Thanks.
Thank you. The leading - and + are used to identify the entries coming from files and are important. I am going to try this and see if that works in all cases (I have multiple files that are being compared and reported).
diff -y file1 file2 | grep '|' | sed 's/\s*|\s/\n/g' | awk '!(NR%2) {$0=$0"\n"} 1'
line 3 diff
line 3 diff.
line 4 diff
line 4 diff.
line 5 diff
line 5 diff.
The script compares different type of files (properties files that have many stanzas, list of stanzas, files that contain crontab listing, ...)
It creates an HTML email and I simply have it create a table and mark lines that start with '-' in one color and the ones starting with '+' a different color. As I am expanding its use, it would be ideal to have diff report differences one line at a time.