FILE-A has 100,000 lines. FILE-B is 50 search terms. I'm looking to complete the search of FILE-A (CSV or TXT) with the various terms from FILE-B (CSV or TXT) AND -- here is the kicker -- save the results in individual TXT files based off the search terms from FILE-B.
Example:
FILE-A
123
45678
1239870
2349878
39742366876
41967849
789
910
2378
6723
FILE-B
1
2
23
78
Results = "1.txt" with all matching lines from FILE-A, "2.txt" with all lines matching from FILE-A, "23.txt", "78.txt" and so on. So if FILE-B has 50 search terms, I would end up with 50 TXT files, named with the search term, assuming at least one hit with said term from FILE-A.
I have searched using "fgrep -f FILE-B.txt FILE-A.csv >> output.txt" This puts all of the search terms from FILE-B found in FILE-A into one "output.txt". I'm instead looking to separate them into individual text files.