Giter Site home page Giter Site logo

splab1's Introduction

splab1 - shell scripting

[deadline is week06-07 labtime, October 07-18, 2019]

Aim

  • To master basic and not-so-basic UNIX/Linux shell commands and scripting.

Task

You are to write shell-script that will process an access log file of Apacher web-server and output some information to the console (depends on your variant). Your script should use only standard command line tools like cut, paste, head, tail,cat, tac, wc, join, grep, sort, sed, uniq, awk, expr, et cetera, and should not use other programming languages like C, Perl, Python etc. The file consists of records. Each line has only one record. A record has the following format:

<client host> - - [<timestamp with timezone>] <HTTP-request line (type, URL, version)> <Code of HTTP-response> <Number of sent bytes or '-', if the response is empty> <Referer string ('-'  means direct request without referer)> <Client info (browser, application)>

Example of a record:

host-24-225-218-245.patmedia.net - - [01/Oct/2006:06:33:45 -0700] "GET /example/example.atom HTTP/1.1" 304 - "-" "NetNewsWire/2.0b37 (Mac OS X; Lite; http://ranchero.com/netnewswire/)"

Interpretation of the above record:

  • On 01/Oct/2006:06:33:45 -0700 from the host host-24-225-218-245.patmedia.net via HTTP/1.1 protocol was issued a GET request to get the resource at /example/example.atom. Response code from server is 304. Such a response has 0 sent bytes (-). Referrer is empty. Client used NetNewsWire/2.0b37 and client OS was Mac OS X.

Your Solution

Your solution should be stored in file ./solution/top. To run the solution make it executable by chmod +x ./top command. Your solution will typically include 2-7 lines of commmands. A one liner solution is also possible but probably it will look ugly (my subjective point of view).

Your solution will be crossvalidated on sub-chunks of the log.txt file provided above. You can split your log.txt into chunks using split command. Our testing script will run your solution and compare its output with our "correct" outputs by diff command. Thus your solution will be judged.

Best of luck!

Credits

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.