Search text in multiple files in Eclipse

There are many times when a developer needs to search some text in the code. The developer may know the file name in which the text is to be searched or may need to search the text in the complete workspace.

We will see a single way through which we can search the text in specified files, workspace or files with particular extension.

Let us see steps to search the text :-

Step 1 :- Press Ctrl+H. A popup will open with multiple tabs.

Step 2 :- Click on ‘File Search’ tab on the top.

Step 3 :- In the ‘Containing text’ textbox write the text to be searched. In the ‘File name patterns’ textbox write the name of the file to be searched. Now click the ‘Search’ button.

Step 4 :- A search tab will be opened with the search results showing the location of the text.

Step 5 :– Double click on the searched text to directly open the file in which the text is present.

Important Note :-

  1. Search text in complete Workspace :- In the ‘File Name Patterns’ text box enter * symbol where * denotes any string. It will search the text in all files of all projects in the workspace.
  2. Search text in files of particular extension :- If we want to search text only in java files then in the ‘File Name Patterns’ text box enter *.java where * denotes any string. It will search the text in all the files with .java as extension. Similarly for xml files enter *.xml or for html files enter *.html.
  3. Search text in a particular file :- In the ‘File Name Patterns’ text box enter complete file name to search the text in that file only.

Let us see How to create web project in Eclipse.

Leave a Comment