home *** CD-ROM | disk | FTP | other *** search
- xtr - Extraction utility Ver 1.00 (C) 1987 Noam Naaman
-
- 0. Disclaimer, Trademarks, my name and address etc.
-
- I make no representation or warranties with respect to the
- contents hereof and specifically disclaim any implied warranties
- to the suitability of this program for any particular purpose.
- You must determine that yourself. In addition, you should
- understand that using a program of this type on an IBM PC or
- compatible has inherent risks and that you may inadvertently
- damage or destroy valuable programs or data. I expressly
- decline to assume liability for any use of this program by you,
- and your use of this program constitutes your agreement to hold
- me blameless.
-
- BUT if someone finds a bug and goes to the trouble of telling me,
- I would be more than happy to fix it and upload an update.
- I also welcome any other comments and suggestions.
-
- Noam Naaman
- 406 Prospect Ave #4K
- Hackensack, NJ 07601
-
- CompuServe 72447,420
-
- (201) 343-7242
-
-
- 1. Description
-
- xtr is a text line extraction program which can selectively let
- lines pass through to standard output.
- xtr may receive its input from a file or from standard input
- making it a "filter" in Unix terminology.
- Why xtr? There are many reasons but I'll give a few examples:
-
- 1.1 After a session with a BBS with capture on, you have a file
- cluttered with lines like:
- L(ist) (-) M(ore) R(eply) H(elp) Q(uit) >
- < More - C(ontinuous) Y/N >
- To get rid of these lines before printing the capture file,
- run xtr on this file and delete all lines equal to the two
- above.
-
- 1.2 In the same file mentioned above, there is a list of ARC
- files which can be downloaded from that BBS. You would like
- to print only lines which contain an ARC file description
- and then sort the file names.
- All you have to do is xtr the file with the appropriate key
- and pipe it to sort.exe.
-
- 2. What is a key?
-
- A key is a string of characters which is used by xtr to determine
- the status of each incoming text line. Up to 200 keys may be
- defined. Each input line will be tested with all keys until there
- are no more keys or a positive comparison is encountred.
- There are two ways to define keys:
-
- 2.1 Single key definition on command line. A key may be specified
- on the command line by preceding it with -s (e.g. -sKEYSTRING).
- If you need only one or two keys, this is the preferred
- method.
-
- 2.2 Key file definition. You may create a text file which will
- be read by xtr prior to processing incoming text. Each line
- in the key file should contain a single string starting in
- column 1.
-
- 3. Command line options
-
- Command line options define the way in which xtr will process
- its input. Options should have at least one space between each
- other.
-
- -k<file> Specify file name containing keys.
- -i<file> Specify input file. default is standard input.
- -c<number> Specify field's 1st column. default is column 1.
- -w<number> Specify field width. default is 1.
- -s<string> Specify single key. Can be repeated.
- -x<file> Specify extract file. Write to this file all
- line which are not being output to standard output.
- -v Reverse selection. Output lines which do not
- equal to any key.
- -f Floating. Lines will be scanned for occurance of key
- as opposed to a comparison starting at a fixed column.
-
- 4. Examples
-
- Extract all lines of a DIR listing having .ARC as suffix and then sort
- them.
-
- dir | xtr -s.ARC -f | sort
-
- Extract all lines of a DIR listing having .ARC as suffix and then sort
- them. All other lines are to be saved in a file called "others".
-
- dir | xtr -s.ARC -f -xothers | sort
-
- Extract all lines of a DIR listing having a file name which starts with
- ABC and sort them.
- All other lines are to be saved in a file called "others".
-
- dir | xtr -sABC -c1 -w3 | sort
-
- Extract all lines of a DIR listing having a file name which starts with
- ABC, XXX, ZZZ or QWE. Use a key file. Take input from a file called tmp.
- First create a key file (call it key1) which will have 4 line:
- ABC
- XXX
- ZZZ
- QWE
- (eof)
-
- dir > tmp
- xtr -kkey1 -c1 -w3 -itmp
-