I am using this diff to show whether two files differ, but I need the regex to ignore the lines that are different that I don't care about. But the way it is set up it changes the names of the files when it reports a difference.

diff -q --suppress-common-lines -B <(grep -vE '\s(name|timestamp|root)=' goldcopy.xml)  <(grep -vE '(\sname|timestamp|root)=' QJ03425234.xml)

It reports something like "Files /dev/fd/63 and /dev/fd/62 differ", but I need it to be the file names so if someone does not know what files it ran with they can still know what files are different.

1 Answer 1


What diff actually compares in your oneliner, are not the files but the output of grep. For each of those two file descriptors dynamically are created by shell (bash), /dev/fd/63 /dev/fd/62 are they usual names. <( command ) idiom is known as process substituion, So there's no direct way for diff to know the original file names, unless you tell it that explicitly. Consider using --label or -L option

F1=goldcopy.xml; F2=QJ03425234.xml;  diff  -L $F1  -q --suppress-common-lines -B <(grep -vE '\s(name|timestamp|root)=' $F1)  -L $F2 <(grep -vE '(\sname|timestamp|root)=' $F2) 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .