while read line
do
c=0
while read files
do
grep "$line" "$files" && c++
done<All_file_list
if [[ "$c" -gt 50 ]]
then
echo "$line 50 times"
fi
done<search_file
Yes, this approach might not be efficiency. there are millions of strings in my file and hundreds of files to be searched. Do you have any other smart suggestions?
I am not sure if I can recommend another smart approach, but I believe my approach will run much faster than pamu's script since he/she is using looping structures.
Did you try running both & check if you are getting the desired results?
---------- Post updated at 02:01 PM ---------- Previous update was at 01:44 PM ----------
It works! vgersh99 gives a similar solution. Both of your codes runs faster.
However, what I want exactly is the string and the file numbers which each string appears in.
I'm studying your code and try to figure out how can I get what I want.