I have 2 files file1 contains list of patterns I need to grep eg: abc bcd def file2 contains names of the files along with absolute path eg: /prod/users/abc/username/filename1.dat /prod/users/abc/username/filename2.dat /prod/users/abc/username/filename3.dat
i have to grep abc in /prod/users/abc/username/filename1.dat bcd in /prod/users/abc/username/filename2.dat def in /prod/users/abc/username/filename3.dat
Can anyone help me here with the UNIX code. the following does not work
for i in cat file2
do for j in file1
do cat -n $i| grep $j >> file_final.txt done done
Aucun commentaire:
Enregistrer un commentaire