Reputation: 67
I am using Windows OS.
My program:
#!/bin/bash
OIFS="$IFS"
IFS=$'\n'
find teste1 -type f | while read -r firstResult
do
find teste2 -type f | while read -r secondResult
do
firstName=${firstResult##*[/|\\]}
secondName=${secondResult##*[/|\\]}
if [[ "$( echo "$firstName" | tr [A-Z] [a-z])" == "$( echo "$secondName" | tr [A-Z] [a-z])" ]]; then
echo "$firstResult" "$secondResult" >> equal
else
echo "$firstResult" "$secondResult" >> notEqual
fi
if [[ $firstName == $secondName ]]; then
echo "$firstResult" "$secondResult" >> equal2
fi
done
done
diff -2 "--line-format=%L" "--unchanged-line-format=" equal equal2 > renamedFiles.lst
rm equal
rm equal2
rm notEqual
Whenever I run this program, it says "diff: conflicting line format". However, it produces the "renamedFiles.lst" and produces exactly the way I want. So, why is it giving me this answer? Can I fix it? It doesn't really affect my program but no one likes seeing warnings / errors on their programs, right? :)
Upvotes: 0
Views: 420
Reputation: 58788
I think it's because you are using both --line-format
(to format all lines) and --unchanged-line-format
(to format unchanged lines). I guess diff
doesn't define what to do if it gets conflicting format specifiers, so it fails and tells you about it. What you could do is use for example --old-line-format=%L --new-line-format=%L --unchanged-line-format=
Upvotes: 1