Question: Assume we have a program named bigbrother, whose output format is as follows: username login_time => logout_time minutes_on If a user hasnt logged out, the

Assume we have a program named bigbrother, whose output format is as follows: username login_time => logout_time minutes_on

If a user hasnt logged out, the logout_time is set to none. Times are otherwise in 24-hour format. The program resets every day at midnight; if someone logged in at 11:30pm, then at 12:01am it would say that they logged in at 12:00, and had been on for 1 minute.

Here is some sample output, assuming youve run the command at 11:30pm:

bart. 23:20 => none 10

homer. 10:15 => 10:18 3

homer. 10:20 => 10:30 10

smithers. 7:45 => 22:01 856

smithers 11:15 => 12:27 72

Bart logged on 10 minutes ago, and is still on. Homer logged in at 10:15am for three minutes, and later logged in at 10:20am for 10 minutes. Smithers was logged in most of the day in one window, and also opened a second window for just over an hour.

Note that: (1) the program uses groups of spaces, sometimes more, sometimes fewer, so the output is in neat columns. (There are no tabs in the output.), and (2) the output is sorted by username for everyone who logged on today in the order they logged in.

Write shell commands that begin with bigbrother | and generate the following output:

(a) (two points) Show the full lines for the five longest login sessions of the day.

(b) (two points) Show only the names and minutes used for all sessions. You may only use a single awk command after the pipe.

(c) (two points) Show only the names and minutes used for all sessions. You may not use awk in your answer.

(d) (two points) Show the full line for all login sessions that began before 9am.

(e) (two points) Show the full line for all login sessions that ended after 5pm.

(f) (four points) Give the total login time for user montyburns, counting all login sessions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!