Tag Info

New answers tagged


It looks to me like both files are already sorted on the first field. If so: join file1 file2 is best, by about as far as your files are large.


You can use awk: $ awk 'FNR==NR{a[$1];next}($1 in a){print}' file2 file1 A0001 C001 A0024 C234 B1542 C231


This should do the job: grep -Ff File2 File1 The -f File2 reads the patterns from File2 and the -F treats the patterns as fixed strings (ie no regexes used).

Top 50 recent answers are included