I have two files with following contents
file 1:
9/09a-A5
9/09a-A18
9/09b- 2B
9/09a-A9
9/09b- 7
9/09a-A11
9/09a-A14
9/09c- 16
9/09b- 5
9/09b- 12
9/09a-A25
9/09a-A10Y
9/09a-A17Z
9/09a-A12Z
9/09b- 4Z
9/09a-A26Y
9/09a-A13
9/09a-A27
9/09a-A19
9/09a-A10
9/09a-A17Y
9/09a-A4
9/09a-A7
9/09a-A15
9/09b- 1
9/09a-A19Z
9/09a-A26
9/09a-A16
9/09a-A22Z
9/09a-A10Z
9/09a-A26Z
9/09a-A13Z
9/09b- 9
9/09b- 4
file 2
9/09b- 2
9/09b- 2A
9/09b- 2B
9/09b- 4Z
9/8B-13
9/9A-11
9/9A-13
9/9A-13Z
9/9A-14
9/9A-6
9/9A-8
9/9A-A13
9/9B-1
9/9B-10
9/9B-12
9/9B-3
9/9B-4
9/9B-5
9/9B-7
9/9B-9
9/9C-15
9/9C-16
9/9D-17
I want to take row 1 from file 1 and search for same name in file 2, if it is there then print. Please note that there are spaces and upper and lower cases to be ignored while searching. here result should be
9/09b- 2B
9/09b- 5
9/09c- 16
9/09b- 12
9/09b- 4Z
9/09a-A13
9/09b- 1
9/09b- 9
9/09b-
grep -xF -f file1 file2
. – leekaiinthesky Aug 16 '16 at 04:59