Search files for text matching format of a Unix directory

Posted by BrandonKowalski on Super User See other posts from Super User or by BrandonKowalski
Published on 2013-07-01T19:51:53Z Indexed on 2013/07/02 5:07 UTC
Read the original article Hit count: 492

Filed under:
|
|

I am attempting to search through all the files in a directory for text matching the pattern of any arbitrary directory. The output of this I hope to use to make a list of all directories referenced in the files (this part I think I can figure out on my own).

I have looked at various regex resources and made my own expression that seems to work in the browser based tool but not with grep in the command line.

/\w+[(/\w+)]+

My understanding so far is the above expression will look for the beginning / of a directory then look for an indeterminate number of characters before looking for a repeating block of the same thing.

Any guidance would be greatly appreciated.

© Super User or respective owner

Related posts about command-line

Related posts about regex