简体   繁体   中英

search for each line in another file using bash

I have two text files[raw file with lines and dictionary file with keywords]. Search for each word in dictionary file in raw file, if there is a match then print the dictionary word next to matching line in raw file.

You can tell grep to read patterns from a file using the -f option. You can also use the -w option to search for words only.

grep -wf dictionary.txt rawfile.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM