Categories
Tech Notes

Shell – How to get surrounding lines of grep result?

Problem:
I'm using grep to search for an error and want to display the surrounding lines also as they contain related information. How to do that?

Solution:
Using grep -C <# of lines to show above and below> <search> <file>

The following prints the matched line, along with the 5 lines surrounding it.

$ grep -C 5 "search" sample_text

Also we can use grep -A or -B to display number of lines above or below the matched line.

The following prints the matched line, along with the 5 lines after it.

$ grep -A 5 "search" sample_text

The following prints the matched line, along with the 5 lines before it.

$ grep -B 5 "search" sample_text

Reference:

Categories
Tech Notes

OpenOffice.org 3.0.1 comes with Grammar Checking

OpenOffice.org 3.0.1 is out by now and what make this release exciting for me is the new integrated Grammar Checking feature.

OpenOffice.org 3.0.1 incrementally improves the grammar checking infrastructure via an API for a grammar checker in the Writer text editor. The previous version 3.0 allowed the LanguageTool extension to provide grammar checking, and version 3.0.1 extends the spell checking dialog for grammar checking. The project’s Florian Effenberger describes the API as a way of integrating external grammar checking tools, and the Writer language dialog box was adapted to show the name (and available logo) of the integrated tool. In addition, the user dictionary now allows a maximum 30,000 entries (up from 2,000).

Also the OpenOffice.org developers fixed nearly 1000 issue and have added an army of new features and enhancements. OpenOffice.org downloads for diverse platforms and around 90 localizations are available here.

Categories
Tech Notes

Custom Search Engine on the fly

Google has been offering its Custom Search Engine for websites for some time. But until now it required us to generate code for Custom Search Engine specifically for each site giving site URL and other details.

Now here is a solution for that, where you can insert Custom Search Engine to your blogs and webpages on the fly. Its simple – just need to copy and paste the small code segment. To get the code go here.

Categories
Tech Notes

Notepad++: Its and IDE

Most of my friends know me as a person advocating for Linux and FOSS . But most of them get surpurised to see me using Vista half the time. There are few reason I have for that, but this post is not about that.

While I’m on Linux I really enjoy the text editors such as Kate and gedit , (I’m not a big fan of vi and vim ). But when it comes to Windows I missed them with the default Notepad. Then only I found Notepad++ . A cool feature to Notepad++ that was available not in the Windows Notepad is a spell checker feature. This feature is not automatically installed with the initial installation of Notepad++, but we just have to install GNU Aspell , a pre-compiled dictionary. Once you download and install the latest version of Aspell, and a dictionary from for your language of choice (English in my case), from the GNU ASpell site you are ready to use this is a cool feature, and this helps me a lot for sure.

Notepad++ also has many more plug-ins, which make it more like a full fledged IDE, specially FTP browser, Syntax highlighting, Auto-completion and others will help any developer have a great time coding. Here are some of the features it offers with the default install of Notepad++:

  • Syntax highlighting (and brace and indent highlighting)
  • Regular expression find and replace
  • Split screen editing
  • Zooming
  • Spell checker (built in but requires Aspell)
  • Tabbed document interface
  • FTP Browser (plug-in included in standard installation)
  • Support for various file formats including Unicode.
  • File Status Auto-detection
  • Zoom in and zoom out
  • Auto-completion (language and file)
Notepad++ is available only for the Microsoft Windows operating system. However, users can still get Notepad++ to work on other platforms, like Linux and Mac OS X, using software such as Wine .
Official site: http://notepad-plus.sourceforge.net/ 
Download: http://notepad-plus.sourceforge.net/uk/download.php
Categories
Tech Notes

WebSVN – Web-based Subversion Browser

I am working on my final year project (Project eID) these days, and I had to setup the SVN repository at our domain, and that worked fine, thanks to Dreamhost One-Click Subversion installation. But then I looked out for a web based Subversion repository browser so things could look a little more nicer and found WebSVN. is the easiest among other similar ones interms of ease of install and features. 

WebSVN is a web based Subversion browser written in the PHP programming language. It took less than 10 minutes to install. WebSVN supports templates, so I might want to port it to our own design if time permits.

I just installed it and I'll have to play around a little more with it to get a better picture on it, but as of now I like it and suggest it.

Just check out my installation at http://svn.project-eid.org/&nbsp;