Find string in a list of files


How do I search for a piece of text in all the files in a given directory and have the search results be the list of files that have that piece of text? In sublime or textpad this is the “Find in Files” function.


Try ctrl-shift-F. You’ll get the find in project dialog


If you don’t like the find in project that @mark_hahn suggested, you could always use grep in the command line. That does exactly what you want.


If you are lucky enough to have a posix environment, which I don’t. (grin)


StackOverflow to the rescue! Here are a bunch of alternatives for grep on Windows.


Assuming you have Git installed, so you can simply use Git Bash to have grep (and many other goodies) on Windows.


@mark_hahn, I find PowerShell to be rather nice on Windows. It’s totally different than the Unix stuff I’m used to, but it’s better integrated with Windows than the Unix stuff. PowerShell has the Select-String command (also known as sls).


Thanks all. I did see “Find In Project” under the Find menu item, didn’t realise it would do what I wanted, I should have tried it before I posted. Now that I have looked at it, it seems limited to the ‘current’ directory, tho.

I’m on Windows but I do have git bash and am happy to use grep, I just happened to be editing a file when the requirement came up.

What little of Powershell I have seen I find rather too new and not worth the effort :slight_smile:


“Find in project” searches in the project, and that may be the current directory or not. The idea is, you do atom /some/directory from a command prompt, and then that is the directory you see in the tree view on the left, and that is the directory that is searched by “Find in project”. It’s also the directory that is searched by cmd-T (ctrl-T?) for files, and so on.


Good point, didn’t think along those lines. Tx


This worked for me: Right-click on a folder in treeView and select SearchInFolder.


I didnt know about this, this is a great feature!


Thanks, it was exactly what I was looking for


I really like the feature in PSPad where you can see the results in a file and being able to double-click the result jumping to the related line in the file.
Also works in multiple files.


Thanks a lot. :slight_smile:


We can do this by ctrl + shift + f

In the project name enter field, type projectname,*.js for searching only words in js files