Linux Utils - Episode 2

Ever needed to do file content searches? NO! Then you probably aren't a programmer... j/k

I frequently have to search lots of code for some pattern. You'd think this would be a trivial task, but not even large IDE's like Eclipse make this easy for you... usually they do... but not always.

So, in the cases where my IDE doesn't do the trick I use Sagasu. Sagasu is a front end for traditional file system searches but takes all the complexity out if it, without loosing the power that the command line can bring...

It supports regex patterns, file name patterns, case handling, root directory, multiple tabed searchs, and many other little features that make it very useful. I like that I can specify what application will load a given search result when I click on it... and that (if the app supports it) it can go right to the line in question...

Here's a screen shot after startup:

screenshot 1 of Sagasu

 

So, recently I had to find all the files in the portal (trunk) that defined an inline style, setting a font size. The regular expression of which was style=".*font-size.*". And I only wanted to look in *.jsp, *.jspf, *.js, *.vm. I could safely ignore anything else. Also, I want to open them in gedit at the matching line. (Yes, I can probably do this search in Eclipse... But that wouldn't make for a very usefull blog post about Sagasu, now. Would it?)

Here is the setup view:

screenshot 2 of Sagasu search setup

 

And here are the results:

screenshot 3 of Sagasu search results

79 matches... Ouch!. Gotta fix that...

 

Anyway, you get the file name/path/line# and the line itself in the result list:

screenshot 4 of Sagasu search line fragment

 

And finally, here it is opening a result file in gedit at the correct line:

screenshot 5 of Sagasu opening gedit at correct line

 

Well, there you have it... Sagasu. Enjoy!

 

The ubuntu (debian) install command would be:

    sudo apt-get install sagasu