smw:/working/iso_testing # cat a
QConvergeConsoleCLI-1.1.03-49.x86_64.rpm
aaa_base-13.2+git20140911.61c1681-1.3.i586.rpm
acpica-20140724-2.1.2.i586.rpm
test.rpm
smw:/working/iso_testing # cat b
QConvergeConsoleCLI-1.1.03-49.x86_64.rpm
aaa_base-13.2+git20140911.61c1681-1.3.i586.rpm
acpica-20140724-2.1.2.i586.rpm
--If I diff them I see this:
smw:/working/iso_testing # diff a b
4d3
< test.rpm
I want to take THAT output (test.rpm) and grep it out of a third file. A.K.A. file c:
smw:/working/iso_testing # cat c
QConvergeConsoleCLI QConvergeConsoleCLI-1.1.03-49.x86_64.rpm
aaa_base aaa_base-13.2+git20140911.61c1681-1.3.i586.rpm
acpica acpica-20140724-2.1.2.i586.rpm
test test.rpm
My desired output would look something like
test test.rpm
Perhaps I have to many files to begin with but I'm stuck.
Thanks in advance
File A is the list or rpm's from one repo, file B is a list of rpm's from a .csv file, and file C is a copy of file B but with package names, not just the rpm.***
try awk - do a difference for a b in awk, remember it, find it c
Order file names parameters you give to awk is important: should be b then a then c where a is the file with the difference, c is the file to do a lookup,
will find many different records not in file b searching file c.
awk '
FILENAME=="a" {arr[$0]++; next}
FILENAME=="b" {if( !arr[[$0] ) {srch[$0]++}
FILENAME=="c" {if(srch[$0]) {print FILENAME, $0}
' b a c
That sounds like an unexpected result of the diff "command substitution", which in turn might be due to non-compliant input files' contents.
Please post the result of the diff alone / on its own.
smw:/working/iso_testing # diff -y -b --suppress-common-lines a b | cut -f1
test.rpm
zip.rpm
smw:/working/iso_testing #
smw:/working/iso_testing # grep $(diff -y -b --suppress-common-lines a b | cut -f1) c
grep: zip.rpm: No such file or directory
c:test test.rpm