Click to See Complete Forum and Search --> : Need help with grep command


matt1776
06-16-2006, 05:11 PM
im struggling on this one it should be easy.

im looking for a file in a directory that contains this exact string
"TX1010202022006061315513900552"

the files look like this
"TX10102020220060613214440006120000000000000000612_B00000000_000.jpg"

ive tried a few variations of grep, but each time, the command line disappears and never comes back, as if it was looping or locked up.

NogDog
06-16-2006, 05:54 PM
grep by itself is going to read lines from the files, not the file names. I think what you want is:

ls | grep TX1010202022006061315513900552

(That's the vertical line "pipe" character after the "ls" command.)

matt1776
06-16-2006, 05:57 PM
got it, perfect.

The key for me was:

grep looks inside files. I didnt realize that. So grep in this case is acting as a filter to only return the listing of those matches.

Thanks again. big help as always :)