Page 1 of 1

For this assignment, you will use awk only. Do not use bash, sed, perl, Python, or any other languages/utilities not exp

Posted: Sun Jul 03, 2022 11:22 am
by answerhappygod
For This Assignment You Will Use Awk Only Do Not Use Bash Sed Perl Python Or Any Other Languages Utilities Not Exp 1
For This Assignment You Will Use Awk Only Do Not Use Bash Sed Perl Python Or Any Other Languages Utilities Not Exp 1 (117.09 KiB) Viewed 10 times
please answer completely and correctly
For this assignment, you will use awk only. Do not use bash, sed, perl, Python, or any other languages/utilities not explicitly specified. News Commands Awk Script You have set up a news server and your feed has just sent you an active file. Rather than typing and executing the commands on an individual basis, you decide to write an awk script to create (from the active file) a file consisting of the necessary addgroup commands. You then plan to execute the file containing the addgroup's. 1. The active file is in the given zip file. 2. The lines in the active file have the following format: comp.os.linux.announce 0000002587 02190 m. comp.arch 0000028934 28874 y utsa.cs.2413 0000000004 0000000001 y 3. Each line in the active file should be converted to an addgroup command. For example, the previous three lines should generate the following commands: addgroup comp.os.linux.announce m addgroup comp.arch y addgroup utsa.cs.2413 y 4. The awk script must be named news. awk, and you should be able to run the conversion with the following command: awk -f news.awk active > news.commands News Server Usage Script Your news server is now up and running and you wish to view a summary of the amount and type of news traffic being fed to your news server. In particular, for each feed site, you want to see how many articles were accepted, canceled, or rejected. 1. The news file is also in the zip file. 2. The news distribution daemon, innd, will write one line for each article in the news file. This is a text file with a variable number of space-separated fields in one of the following formats: mon dd hh:mm:ss.mmm + feed <Message-ID> site... mon dd hh:mm:ss.mmm j feed <Message-ID> site... mon dd hh:mm:ss.mmm c feed <Message-ID> site... mon dd hh:mm:ss.mmm - feed <Message-ID> site... Assignment 3: awk Page 1 of 3
The first three fields are the date and time to millisecond resolution. The fifth field is the site that sent the article (based on its path header), and the sixth field is the article's Message-ID; there will be a question mark if the information is not available. The fourth field indicates whether the article was accepted or not. If it is a plus sign, then the article was accepted. If it is the letter "j" then the article was accepted, but filed in the "junk" newsgroup. If the fourth field is the letter "c" then a cancel message was accepted before the original article arrived. In all three cases, the article has been accepted and the "site..." field contains a space-separated list of sites to which the article is being sent. If the fourth field is a minus sign then the article was rejected. 3. Your news server has the following feeds: swrinde news.cais.net. ? 4. Calculate the following information for each feed: The number of articles accepted from each site. The number of articles rejected from each site. The number of articles canceled from each site. 5. The date and time of the first entry as well as the last entry should also be printed. The news file represents one day of traffic. - 6. Because the news file is quite large, you may want to use the head command to create a smaller file of approximately 1,000 lines on which to test your program. 7. This awk script's filename must be called newsfeed.awk. 8. The output should be formatted as closely as possible to the following: Output of newsfeed.awk script 1 2 3 4 swrinde: 5 news.cais.net: 6 7 8 ?: Incoming News Feed Summary Assignment 3: awk accepted 94691 14371 3 Start Time = Feb 13 21:28:38.409 rejected 11947 240 0 canceled 0 0 3 End Time Feb 14 20:56:49.066 Page 2 of 3
Script Execution Your scripts should be invoked directly via the command line, as seen in the following examples: $ awk -f news.awk active > news.commands $ head -n 50 news.commands > news50.out $ awk -f newsfeed.awk news > newsfeed.out Script Files Your program should consist of exactly two files: news.awk - awk script responsible for parsing and reformatting the active data file newsfeed.awk - awk script responsible for parsing the news data file Submission Turn your assignment in via Blackboard. Your zip file, named asg3_abc123.zip (where abc123 represents your UTSA ID) must contain your two awk scripts, the news50.out file, and the news feed.out file. Do not include copies of the data files!