Nancy Street

ngrep

Click to see the Site Map
HomeInfoMusicGalleryPetsGeoHobbiesGeo
Site MapWhat's NewRecent ChangesContactsServer StatisticsSite Information Home « Computers « ngrep

ngrep is a command line utility that searches for text in files. It was written in C# under the .NET 1.1 Framework. For many years I used the Turbo GREP 3.0 utility that was supplied with the Borland C++ 5.0 development kit. This old utility worked well for many years, but under Windows XP it stopped reporting long file files and I found the number of options inadequate.

In early 2003 I noticed that the .NET Framework namespace System.Text.RegularExpressions had built-in classes that supported the full implementation of full regular expression matching. Since most of the hard work was already done by the Framework, I simply wrote a command line utility in C# with plenty of behaviour switches to wrap around the pattern matching.

Here is the help display from ngrep when no parameters are entered:

FUNCTION:
A command line grep (Version 1.6.1789.23534).
SYNTAX: ngrep filemask expr1 [expr2 expr3 ...] [-switches]
expr(s) ...... Regular expression.
filemask ..... File mask to scan.
-i ........... Ignore cases.
-c ........... Count matches.
-d ........... Recurse directories.
-v ........... Verbose mode.
-n ........... Display line numbers.
-s ........... Short line display.
-f ........... No file name display.
-F ........... File name separator lines.
-x ........... List lines not containing.
-eEEE ........ EEE = utf7/utf8/ascii/unicode.
-zSSS ........ Skip file names containing 'SSS'.
-mnnn ........ Search a maximum of nnn lines (stop after nnn lines).

I won't bother explaining all of the parameters in detail to other developers, but you should see that the switches provide these features:

A description of the regular expression syntax can be found at MSDN Introduction To Regular Expressions.

ngrep Project - (11KB) ZIP of the Visual Studio .NET 2005 Project with source code
ngrep Executable - (13KB) ZIP of the EXE file only

Back to: Computers & Software Main Page


Contact Information | PGP Keys | Site Map | What's New | Visitor Book
Last Updated: 06-Aug-2007 21:12
Copyright © 1999-2007 Orthogonal Programming