I’ve got a text file with some lines and saved the text file into an array using
readarray -t array < Textfile
The Text file contains e.g. the following:
123
456
789
Now I’d like to use the grep command to look for the results in another text file using the array, so print out lines where “123”, “456” or “789” appear.
To test the array thing, I tried to make grep look for “123”, “456” and “789” the same text file and output the matching lines, if at least one of the three character series appears.
I tried
grep "${array[*]}" Textfile
but this doesn’t show any results. What am I doing wrong?