Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create the .cookies file for each of the websites in the hosts file(see picture) using wget command. The code should be written in bash script.

create the ".cookies" file for each of the websites in the hosts file(see picture) using wget command. The code should be written in bash script.

image text in transcribed

image text in transcribed

image text in transcribed

Please login to one of the linprog servers, and enter bash. Then create a file called "hosts" that has the following entries: bash-4.2$ cat hosts www.duckduckgo.com www.eff.org www.google.com www.msnbc.com en.wikipedia.org www.yahoo.com www.zillow.com This week's submission will be a complete bash script named "cop4342-assign6.sh" that should, when executed, do the following: bash-4.2$ ./cop4342-assign6.sh Doing www.duckduckgo.com with command : wget -H -q -P work-dir -e robots=off -p -r -1 1 --keep-session-cookies - -save-cookies www.duckduckgo.com.cookies https://www.duckduckgo.com mkdir: created directory work-dir? real Om4.061s user Om0.0665 sys Om0.078s Doing www.eff.org with command : wget -H -q -P work-dir -e robots=off -p -r -1 1 --keep-session-cookies --save-c ookies www.eff.org.cookies https://www.eff.org mkdir: created directory work-dir: user real 4m20.190s Om1.817s sys Om1.613s Doing www.google.com with command : wget -H -q -P work-dir -e robots=off -p -r -1 1 --keep-session-cookies --Sav e-cookies www.google.com.cookies https://www.google.com mkdir: created directory work-dir? real Om26.349s user Om0.431s sys Om0.360s Doing www.msnbc.com with command : wget -H -q -P work-dir -e robots=off -p -r -1 1 --keep-session-cookies --save Doing www.msnbc.com with command : wget -H -q -P work-dir -e robots=off -p -1 -1 1 --keep-session-cookies -- save -cookies www.msnbc.com.cookies https://www.msnbc.com mkdir: created directory work-dir? real Zm4.0895 user Om2.0815 sys Om1.3765 Doing en.wikipedia.org with command : wget -H -q -P work-dir -e robots=off -D -r -1 1 --keep-session-cookies --s ave-cookies en.wikipedia.org.cookies https://en.wikipedia.org mkdir: created directory "work-dir? real 5m18.904s user Om8.457s sys Om5.398s Doing www.yahoo.com with command : wget -H -q -P work-dir -e robots=off -p -r -1 1 --keep-session-cookies -- save -cookies www.yahoo.com.cookies https://www.yahoo.com mkdir: created directory work-dir real 4m37.653s user Om1.996s sys Om2.533s Doing www.zillow.com with command : wget -H -q -P work-dir -e robots=off -p -r -1 1 --keep-session-cookies --Sav e-cookies www.zillow.com. cookies https://www.zillow.com mkdir: created directory work-dir' real user sys Om0.679 Om0.025s Om0.013s Clearly, your "cop4342-assign6.sh" script should loop over the contents of the "hosts" file; the end result will be that it creates a "cookies" file for each of the websites using the "wget" that you can see above. Your script should have the same output also as the above script (do please include the timing element in your script.) When your finishes running (it probably will take 20-30 minutes unless you are clever about your implementation), you should run "wc" over the result files and see something like: bash-4.2$ wc-1 *.cookies 109 en.wikipedia.org.cookies 4 www.duckduckgo.com.cookies 47 www.eff.org.cookies 11 www.google.com.cookies 31 www.msnbc.com. cookies 39 www.yahoo.com.cookies 9 www.zillow.com.cookies 250 total It's not likely (though certainly possible) that your wc output will be identical; it is conceivable that your "wc" output is quite different since most of these websites change on a regular basis. This is an easy assignment, but it will require putting together many of the techniques that you have seen and used so far this semester. My reference version only has 9 lines of active code, two blank lines, and the initial comment containing #!/usr/bin/bash. Please login to one of the linprog servers, and enter bash. Then create a file called "hosts" that has the following entries: bash-4.2$ cat hosts www.duckduckgo.com www.eff.org www.google.com www.msnbc.com en.wikipedia.org www.yahoo.com www.zillow.com This week's submission will be a complete bash script named "cop4342-assign6.sh" that should, when executed, do the following: bash-4.2$ ./cop4342-assign6.sh Doing www.duckduckgo.com with command : wget -H -q -P work-dir -e robots=off -p -r -1 1 --keep-session-cookies - -save-cookies www.duckduckgo.com.cookies https://www.duckduckgo.com mkdir: created directory work-dir? real Om4.061s user Om0.0665 sys Om0.078s Doing www.eff.org with command : wget -H -q -P work-dir -e robots=off -p -r -1 1 --keep-session-cookies --save-c ookies www.eff.org.cookies https://www.eff.org mkdir: created directory work-dir: user real 4m20.190s Om1.817s sys Om1.613s Doing www.google.com with command : wget -H -q -P work-dir -e robots=off -p -r -1 1 --keep-session-cookies --Sav e-cookies www.google.com.cookies https://www.google.com mkdir: created directory work-dir? real Om26.349s user Om0.431s sys Om0.360s Doing www.msnbc.com with command : wget -H -q -P work-dir -e robots=off -p -r -1 1 --keep-session-cookies --save Doing www.msnbc.com with command : wget -H -q -P work-dir -e robots=off -p -1 -1 1 --keep-session-cookies -- save -cookies www.msnbc.com.cookies https://www.msnbc.com mkdir: created directory work-dir? real Zm4.0895 user Om2.0815 sys Om1.3765 Doing en.wikipedia.org with command : wget -H -q -P work-dir -e robots=off -D -r -1 1 --keep-session-cookies --s ave-cookies en.wikipedia.org.cookies https://en.wikipedia.org mkdir: created directory "work-dir? real 5m18.904s user Om8.457s sys Om5.398s Doing www.yahoo.com with command : wget -H -q -P work-dir -e robots=off -p -r -1 1 --keep-session-cookies -- save -cookies www.yahoo.com.cookies https://www.yahoo.com mkdir: created directory work-dir real 4m37.653s user Om1.996s sys Om2.533s Doing www.zillow.com with command : wget -H -q -P work-dir -e robots=off -p -r -1 1 --keep-session-cookies --Sav e-cookies www.zillow.com. cookies https://www.zillow.com mkdir: created directory work-dir' real user sys Om0.679 Om0.025s Om0.013s Clearly, your "cop4342-assign6.sh" script should loop over the contents of the "hosts" file; the end result will be that it creates a "cookies" file for each of the websites using the "wget" that you can see above. Your script should have the same output also as the above script (do please include the timing element in your script.) When your finishes running (it probably will take 20-30 minutes unless you are clever about your implementation), you should run "wc" over the result files and see something like: bash-4.2$ wc-1 *.cookies 109 en.wikipedia.org.cookies 4 www.duckduckgo.com.cookies 47 www.eff.org.cookies 11 www.google.com.cookies 31 www.msnbc.com. cookies 39 www.yahoo.com.cookies 9 www.zillow.com.cookies 250 total It's not likely (though certainly possible) that your wc output will be identical; it is conceivable that your "wc" output is quite different since most of these websites change on a regular basis. This is an easy assignment, but it will require putting together many of the techniques that you have seen and used so far this semester. My reference version only has 9 lines of active code, two blank lines, and the initial comment containing #!/usr/bin/bash

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions