Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please create a file called “ myloginfile ” as shown below and then write an awk

ID: 3805138 • Letter: P

Question

please create a file called “myloginfile” as shown below and then write an awk script to determine how many logins in file “myloginfile” spent less than an hour on the system.

$ last | grep "Oct 20" > myloginfile

cfs264fa pts/3        c-68-46-14-229.h Tue Oct 20 23:24 - 23:47 (00:22)   

cfs264fa pts/0        c-68-46-14-229.h Tue Oct 20 22:51 - 23:24 (00:33)   

cfs264fa pts/0        c-68-46-14-229.h Tue Oct 20 22:43 - 22:45 (00:02)   

ics325su pts/0        75-168-124-222.m Tue Oct 20 21:57 - 22:15 (00:17)   

ics325fa pts/0        c-98-240-232-78. Tue Oct 20 16:08 - 20:33 (04:25)   

cfs264fa pts/3        173-8-126-169-mi Tue Oct 20 14:57 - 16:07 (01:09)   

cfs264fa pts/0        12.28.108.200    Tue Oct 20 11:33 - 15:15 (03:42)   

cfs264fa pts/0        c-24-118-47-197. Tue Oct 20 05:49 - 06:14 (00:25)

Please provide your awk script below along with a screenshot of the execution of the script:

This is what i have so far but i am running into a syntax error because of the ':'

awk ‘{ if ( $10 < 01:00) print $10}’ myloginfile

Explanation / Answer

Idea:

First subset the time based on mins.. Then, check if the hours are zero. If hours are zero then it is less then one hour. Hence, print that line.