Version 1.0a of June 2002
COPYRIGHT (C) 1997-2002 Norbert H. Doerry
LEXTRACT.EXE is a utility for extracting records from
an ASCII flat file based on a search string. Only those records
in the input file which have a match with the search string are
printed in the output file. If a starting column is specified,
a match means that the search string is identical to the string
starting in the specified column (number of characters from the
start) of each record.
If a starting column is not specified, then a match means the
search string can be found anywhere in the record. The comparisons
are by default case sensitive, but can be specified to be case
Records may either have a fixed length, or may be newline delimited.
If a fixed length is not specified, then the records are assumed
to be newline delimited.
LEXTRACT.EXE infile -sXXX -cXX -i -rXX -oOutfile -?
infile = Name of input ascii flat file
if omitted, data is taken from stdin
-sXXX = XXX is the search string
-cXX = XX is the column to look for the search string,
if omitted, searches the entire record (line)
-i = ignore case of search string
-rXX = record length, including terminating newline if present
if omitted, assumes lines are terminated with newlines
Outfile = Name of ascii output file
if omitted, output is written to stdout
-? Prints Syntax, then exits.
- If a record length is not specified, then assumes lines are
terminated with hard returns (newlines). The maximum length of
a line (if not specified) is 2047 characters.
- If the search string contains spaces, it must be delimited
with quotation marks ""
- If the search string contains a quotation mark, it must be
preceded with a forward slash \
- An unadvertised command option, -d will display all of the
command line arguments as interpreted by the program.
- The column entry assumes the first column is = 1.
- newlines are treated as one character, even if the binary
representation shows two characters.
lextract test1.txt -saaa -c4 -otest1out.txt
lextract test1.txt -saaa -c4 -i -otestiout.txt
This program is free software; you can redistribute it and/or
modify it under the terms of the
GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.