LineCountTable of ContentsHtmlFix2Unix
FileLineFilterRegex

FileLineFilterRegex command line program eliminates text lines from text files based on regular expression patterns.

This program removes all lines which does not match a regular expression from text files places the output files in a separate directory if such directory is specified. The file size must be small enough to fit in available memory.

This utility is useful in a case where you have a large file and you are only interested in a subset of the lines in it. For example, the webserver logs where you only want to see certain user agent, certain ip, or perhaps certain date, time. Another example where we use this an application log where each thread id appears at the beginning of the line. And, for troubleshooting purposes, we only want to see the lines logged by a certain thread. FileLineFilterRegex conveniently removes all other lines for us so that we can focus on what matters for us.

Command line parameters are:

-srcdir   adirectory     directory of the original files. By default, this is the current directory.

-destdir   adirectory    destination directory to save modified files. By default, this is the current directory. The source files will be over written.

-regex     atext       this is the regular expression pattern to match lines to keep. If a line in the source file does not match this pattern, that line will not be copied to the destination file.

-fname     apattern    the file name pattern to search. Default is *.*

-casesens presense of this flag means search is case sensitive.

-quotes   this flag means the following characters are used instead of double quotes in the -find and -replace parameters. This is to help escaping quotes inside your find replace parameters.

-r         recursively process sub directories.

FileLineFilterRegex.exe is part of Bestcode File Utilities tool set.

 

webmaster@gobestcode.com