Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Hint you may need to use the commands cuts grep sort and/oruniq in ur script Checkpoint 2.3: Shell Script to analvze web log (Please submit
Hint you may need to use the commands "cuts" "grep" "sort" and/or"uniq" in ur script Checkpoint 2.3: Shell Script to analvze web log (Please submit and evaluate your answer in VPL) Suppose the web server of your company website that produces a log file which captures every page access in the following fomat: in. address date, YYYY/mm/dd time.HHiMMiSS page.accessed Here is a sample content of such file: You are asked to write a shell script, getProductAccess.sh, which captures the product pages under/products/ accessed by each IP address. The script takes one command line argument, which is the filename of a log file. It will read the content of the log file specified, find and print the product pages each IP address accessed. The output should be sorted by IP address and then by the product page. - Sorting is done alphabetically, ascendingly for both IP address and product page, i.e., 192.168.0.11 will be ordered before 192.168.0.2. - Only pages starting with /products/ should be printed. - You can assume that the input file will strictly follow the above format. I.e.: Each page access is recorded on a separated line. Each value (ip. guddess, date, time and page, accessed) are separated by tabs. The values will not consist of spaces or tabs. - The script does not need to handle cases where the input file is empty, or if there is not enough argument specified. Sample Run Assume we have access-2014-09-04.log in the current directory, with the following content: Sample Kun Assume we have access-2014-09-04.log in the current directory, with the following content: If we run the script like this: $./getProductAccess.sh access-2014-09-04.1og The script will print: Note that IP 192.168.130.175 accessed/products/296.html multiple times, but there should only be one corresponding line in the output
you may need to use the commands "cuts" "grep" "sort" and/or"uniq" in ur script
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started