Search multiple files and prepend file name

root@flynx:~/test# echo "test 1" >> a.txt
root@flynx:~/test# echo "test 2" >> b.txt
root@flynx:~/test# echo "test 3" >> c.txt
root@flynx:~/test# echo "nothing" >> d.txt
root@flynx:~/test# ls
a.txt  b.txt  c.txt  d.txt
root@flynx:~/test# grep . *.txt | grep test
a.txt:test 1
b.txt:test 2
c.txt:test 3

 

Leave a Reply

Your email address will not be published. Required fields are marked *