97159f695c5621cbbb3cfa75803446f2
linux
bash2
v1
rasb14
2019-02-03 13:04:17
v3.1.3 (2018-09-13)

Generated 2019-02-09 12:37:36 by dbwebb lab-utility v3.1.3 (2018-09-13).


Lab 2 - linux

A lab where you use Unix tools available from the command line interface together with a little Bash, to find and handle information in a IRC loggfil.

1. Bash

Train Linux commands and use them together with Bash.

I this exercise you will mainly use comands like grep, wc, head and tail to search for information in a log file from the irc-chat.

Then you combine the output of the commands to variables in Bash. Use the man-pages when needed to find information on how to solve the exercises.

Exercise 1.1 (1 points)

Create a variable named FILE and give it the value ircLog.txt.

Answer with the value of $FILE.

Exercise 1.2 (1 points)

Use the wc command to count the number of lines in the irc log. Show only the number of lines and the name of the file, seperated by a space.

Save the answer in a variable and answer with that variable.

Exercise 1.3 (1 points)

Use wc together with cut to count the number of words in the irc log.

Save only the number of words in a variable and answer with the variable.

Tip: Use the pipe (|) command.

Exercise 1.4 (1 points)

Find the row with ‘pansars’ opinion of ‘notepad’.

Save the answer in a variable and answer with that variable.

Exercise 1.5 (1 points)

Find the last four rows in the logfile.

Exercise 1.6 (1 points)

When was the log opened for the first time? Hint: ‘Log opened’.

Answer with the row that says when the log was opened for the first time.

Exercise 1.7 (1 points)

What does the third line where ‘wasa’ says something say?

Exercise 1.8 (1 points)

How many lines is logged at the time 11:15?

Exercise 1.9 (1 points)

Find the first row where ‘pansar’ says something when the time is 07:48.

Exercise 1.10 (1 points)

Find the first 10 lines from ‘Wed Jun 17 2015’.

2. Extra assignments

Solve these optional questions to earn extra points.

Exercise 2.1 (3 points)

Find the lines that are from the ‘forum’ and contains details about ‘projektet’ and ‘htmlphp’.

Exercise 2.2 (3 points)

What did ‘Bobbzorzen’ say on the line, two lines before he said ‘cewl’?

Exercise 2.3 (3 points)

How many words are there in the fourth to ninth row, under the day ‘Mon Jun 08 2015’?


97159f695c5621cbbb3cfa75803446f2