You have chosen to sponsor your bid up to a maximum amount of .
Objective: Write a program capable of performing some elementary text analysis according to the following specifications. DESCRIPTION This program reads an ASCII text from file textin, performs one analysis operation as specified by one of the options s, f, r, c then writes the result onto file textout.
This program reads an ASCII text from file textin, performs one analysis operation as specified by one of the options s, f, r, c then writes the result onto file textout. OPTIONS -s Sort the input text words lexicographically in ascending order. This program defines a “word?? as any sequence of characters preceded or followed by at least one space, tab or newline characters. The output consists of the number of different input words on one line, followed by a sorted list of all different input words, with one word per line. -f Compute the number of occurrences of all input text words. The output consists of the input words and number of occurrences on one line. -r This option may be specified in conjunction with the -s option (it is silently ignored in all other cases), and its effect is to reverse the sorting order in the output. -c This option may be specified in conjunction with the -f option (it is silently ignored in all other cases), and its effect is to make the program compute the frequency of occurrence of characters instead of words. All ASCII characters must appear in the list, with a frequency of 0 for those absent in the input text. DIAGNOSTICS Upon successful completion the program exits with 0-exit status. Otherwise an appropriate diagnostic message is output on standard error, and an exit status of 1 is reported. In particular, an “Usage'' message, explaining the command synopsis and giving a brief explanation of each option, must be reported on standard error whenever an illegal option is specified on the command line. - You may use input and output redirection to read and write the text files. Alternatively, you may use file handling functions of C. 1. Also In this assignment, you have to use command line arguments to specify the appropriate switch (option) while running your program. 2. Basically, this program should perform 4 tasks as defined with each switch. You may use the switch as command line as you think appropriate.
C programming in Unix