I have a directory named Analysis
. Inside this directory I have some files like below:
Analysis
|_____file1.csv
|_____file2.csv
|_____file3.csv
|_____ReqGenes.csv
file1, file2, file3 have following information.
file1.csv looks like below:
LINC01419
AAR2
AC008560.1
ACTRT3
AKAP17A
AL139353.1
ARG2
ATE1
BORA
file2.csv looks like below:
DUSP28
EID2B
ELOVL6
FAM118B
FAM200A
FDXACB1
FKBP1B
FRAT1
FSD1L
file3.csv looks like below:
KDM4D
KLF12
KLLN
LRRC55
LRRIQ3
MBTPS2
MORN2
MRPS17
MRPS6
MTX3
I usually check whether a specific pattern LINC01419
exists in any of the files in the directory like below:
grep -E "LINC01419" *.csv
The output is like below:
file1.csv: LINC01419
But instead of searching for each gene, I have a file named ReqGenes.csv
looks like below with all the required genes. So, with one command I would like to know in which files the Genes are present.
Genes
LINC01419
MORN2
MTX3
FSD1L
FAM118B
EID2B
ARG2
KLLN
MRPS6
ATE1
The output I need should be like below:
file1.csv: LINC01419, ARG2, ATE1
file2.csv: FSD1L, FAM118B, EID2B
file3.csv: MORN2, KLLN, MRPS6, MTX3
Try using
grep -f
More examples on: https://www.linuxtechi.com/linux-grep-command-with-14-different-examples/
thanks. yes I tried like below:
And the output is like below:
Dont know why it gave output for only last gene in
ReqGenes.csv
. Why it didn't give output for other genes?