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

Create a file signinhw10 as below: last -wi | grep \"Feb 22\" | head -10 >signin

ID: 3813194 • Letter: C

Question

Create a file signinhw10 as below:

last -wi | grep "Feb 22" | head -10 >signinhw10

Use the format in this file for problem.

lab9c2.pl:

Problem:

• Once again, use lab9c2.pl as a template to write a perl script, hw10b.pl, to list for each login to the system, the user id and the login time. You again use the file signinhw10.

• Here is how the program would be executed. The output from my program is also given. To improve clarity, (once again) I have deleted the warnings I got.

./hw10b.pl signinhw10

ics311sp170106 23:47

ics325sp170128 23:33

ics325sp1718 23:02

ics325sp170129 22:58

ics325sp170129 22:47

ics325sp1711 22:44

ics311sp170106 22:24

ics325sp170132 22:19

ics325sp170128 22:15

ics325sp1723 22:02

fs264sp170224Gsp-cfsics last -wi I grep Feb 22 I head. 10 >signinhw10 fs264 sp17022 4Gsp-cfsics cat signinhw10 cs311sp 170106 pts/4 104.200.153.92 Wed Feb 22 23:47 02:51 (03:04) 174. 53.245.117 Wed Feb 22 23: 33 00 16 (00 42) cs325 170128 pts/3 cs325sp 1718 pts/5 66. 41.183.50 Wed Feb 22 23:02 23: 56 (00:53) 66.41.19.59 cs325 170129 pts/8 Wed Feb 22 22:58 01:30 (02:31) cs325 170129 pts/0 66. 41. 19.59 Wed Feb 22 22:47 01:09 (02:21) 66.41.183.50 cs325sp 1711 pts/5 Wed Feb 22 22:44 22:59 (00:14) cs311sp 170106 pts/9 73. 37.196.191. Wed Feb 22 22:24 00 44 (02:20) 209. 63 158.124 Wed Feb 22 22:19 00 46 (02:27) cs325 170132 pts/7 174. 53.245. 117 Wed Feb 22 22:15 23:33 01:17) cs325 170128 pts/3 69.180. 158. 120 Wed Feb 22 22:02 22 38 (00 35) cs325 sp1723 pts/8

Explanation / Answer

#!/usr/bin/perl -w

open(FILE,"./$ARGV[0]") or die("Could not open the file $ARGV[0]");

while ( $line = <FILE> ){

@values = split(' ',$line);
print "$values[0] $values[6] ";
}

close(FILE)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote