Hello,
I'm trying to do something very basic in bash. It's a kind of cross-reference matching between 2 files.
I have a file1.txt. It's like this:
Code:
item1
item3
item4
...
I Have a file2.txt. It's like this:
Code:
item1 "Properties of item1"
item2 "Properties of item2"
item3 "Properties of item3"
item4 "Properties of item4"
item5 "Properties of item5"
...
My goal is to print out the lines in file2 that contains lines present in file1.
I do:
Code:
for i in $(cat file1.txt); do grep $i file2.txt; done
but I get no output. Will someone please tell me where am I mistaking?
Thanks!