I have file 1 which have those lines:
ATM 1434.972183
BMPR2 10762.78192
BMPR2 10762.78192
BMPR2 1469.14535
BMPR2 1469.14535
BMPR2 1738.479639
BMS1 4907.841667
BMS1 4907.841667
BMS1 880.4532628
BMS1 880.4532628
BMS1P17 1249.75
BMS1P17 1249.75
BMS1P17 1606.821429
BMS1P17 1606.821429
BMS1P17 1666.333333
BMS1P17 1666.333333
BMS1P17 2108.460317
BMS1P17 2108
And file 2 have a list of words:
ATM
BMS1
So, the output will be like this:
ATM 1434.972183
BMS1 4907.841667
BMS1 4907.841667
BMS1 880.4532628
BMS1 880.4532628
I know it's really a duplicate question, but I tried all types of grep
and sed
and awk
, maybe it will works with you guys with this tiny example
but I have a very huge file > 1M lines
and all previous way doesn't help
it return part of the lines that containing those words although there are other words in file 2
that matches the lines from file 1
file yourfile
may report something likeASCII text, with CRLF line terminators
or you can inspect a portion of the file withcat -A yourfile