- File Name : TestParts45.java - Usage : java TestParts45 Generate < [inputfile] or echo [n] | java TestParts45 Generate java TestParts45 Sieve < [inputfile] java TestParts45 Replace [s1] [s2] < [inputfile] java TestParts45 Unique < [inputfile] java TestParts45 Tail [n] < [inputfile] ## Generate ## [inputfile] for Generate has only one integer in it. For example, if [inpufile] contains 7, the output will be 2 3 4 5 6 7. Alternatively, you can try: echo "7" | java TestParts45 Generate ## Sieve ## [inputfile] for Sieve should look the same as the output of Generate. So if [inputfile] contains 2 3 4 5 6 7, output should be 2 3 5 7. Alternatively, you can try: echo "2 3 4 5 6 7" | java TestParts45 Sieve ## Replace ## [inputfile] for Replace, Unique, Tail is any text file. Replace replaces [s1] with [s2] in input. java TestParts45 Replace [s1] [s2] < [inputfile] > [outputfile] If you really want to test complicated replaces, use your favorite text editor to do a global replace of [s1] with [s2] in [inputfile], then save the result to a file, say [answerfile]. Then diff [outputfile] [answerfile] should return with no output. ## Unique ## Unique removes consecutive duplicate lines. java TestParts45 Unique < [inputfile] > [outputfile] To test, use the Unix uniq command: uniq [inputfile] [outputfile2] Then diff [outputfile] [outputfile2] should return with no output ## Tail ## [n] argument to Tail works as the project spec says, and the input stream into Tail is a sequence of file names (so [inputfile] in the command line below contains file names separated by whitespace). To test you can use the Unix tail command. Note that for the Unix tail command, a + or - must precede [n], and the command takes 1 file as an argument, and uses the contents of that file. java TestParts45 Tail [n] < [inputfile] > [outputfile] tail [n] [inputfile] > [answerfile] diff [outputfile] [answerfile]