I have a file t.txt
For example, assuming the file contain values like below. Values changes and do not know what it will change to. I want just to grep what inside the file.
[session] cat t.txt
John
Alex
Danny
I want to run a command like this to grep for all of them:
ls -lart | grep -e John -e Alex -e Danny
How i can read those values from t.txt file and put them in pattern as above using -e. I want to grep for whatever values in the file and grep for them all. Those values changes all the time and i want to automate this.
for i in cat t.txt
do ls -lart | grep $i
done
I know the above will work. I do not want loop. I want to use grep patter using -e.
Help me guys..