Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to find all the files that contain a search term:

grep -lir "Search" .

and pipe that into sublime:

grep -lir "Search" . | subl

but all this does is open a single file in sublime containing all the search results file paths as lines in the file. What I would like is to open each of those files as a sublime project.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Using the command subl $(grep -lir "Search" .) will give you the expected output. The $(command) expands with the output of the command and gives it as input to the sublime command. More information can be found in the Bash Manual.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.