terminal: how do i pipe the results of grep to open a file I'd like to grep and open a file in just one terminal command. 

Suppose I'm in this directory:

$ ls
1.txt   2.txt   3.txt   4.txt   5.txt


and I want to open 3.txt

I thought I could do ls | grep 3 | open 

but it looks like open doesn't accept piped input. Is there any way to do this?
Try open $(ls | grep 3). Depending on your specific needs, you can also skip the grep part and use open $(ls *3*) (or even open *3*) directly.