Need to do make utility to find lines in a txt that contain certain words in Java
I have an assignment like follows..can some one help me do this..?
You are required to write a programme that will find lines in a text file that contain certain words. This is broadly similar to the Unix utility "grep" in concept but a number of extra facilities are required.
The command line arguments are to be
1. -a or -o
A single flag of the form "-o" or "-a" specifying whether a required line will be one containing any one of the specified words ("-o" [OR] operation) or whether a required line is one containing all of the specified words ("-a" [AND] operation).
The default is "-o" operation.
2. -w, -t or -r
A single flag of the form "-w", "-t" or "-r" specifying the type of word match. These are
word matching means that the word specified on the command line must be matched exactly by a word in the line of text. This is indicated by the "-w" flag.
stem matching means that the word specified on the command line may be an initial substring of a word in the line of text. This is indicated by the "-t" flag.
string matching means that the word specified on the command line is to be taken as a string of characters that occur anywhere in the line of text. This is indicated by the "-r" flag.
For example if the word "man" appeared on the command line and stem matching were specified then words such as "mankind" and "manufacturing" would be regarded as matching, if string matching were specified then words such as "command" and "woman" would also match.
Stem matching is the default option.
The matching is required to be case insensitive. A word is to be taken as any sequence of alphameric characters enclosed by non-alphameric characters.
3. File name
The command line argument following "-f" is to be taken as the name of the file to be processed.
This is optional. If the "-f" option does not appear on the command line then data is read from standard input.
4. The words
A list of one (or more) words to be found in the data file. This is not optional, the absence of any required words is an error.
The output from the programme will be those lines of text read from the input data that satisfy the match requirements. The selected lines will be written to the standard output. You will be expected to devise a realistic set of tests for your programme and show its correct operation on a variety of data files.
Your programme should be written in standard Java.
Any help is appreciated
By Ant_Magma in forum Java
Last Post: 09-21-2005, 12:49 AM
By Mike Tsakiris in forum .NET
Last Post: 10-04-2002, 06:32 PM
By Kelvin in forum Careers
Last Post: 09-24-2002, 10:42 AM
By Dharmesh in forum .NET
Last Post: 10-01-2001, 04:47 PM
By JayinMichigan in forum Careers
Last Post: 06-20-2001, 03:46 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center