Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with Linux!! 5.4) Based on Lab 7, Handouts 7 (example 1), and HW 7, please create a file called myloginfile as shown below

Need help with Linux!!
5.4) Based on Lab 7, Handouts 7 (example 1), and HW 7, please create a file called myloginfile as shown below and then write an awk script called mylogincheck to check on file myloginfile to see who spent less than one (1) hour on the system and then display those login records. (The last column of the output shown below indicates the time spent on the system).
$ last wi | grep "Mar 31 | head -5 > myloginfile
$ cat myloginfile
cfs264sp1809 pts/5 73.228.165.183 Sat Mar 31 21:36 - 21:46 (00:10)
cfs264sp1809 pts/4 73.228.165.183 Sat Mar 31 20:55 - 23:15 (02:20)
cfs264sp1809 pts/3 73.228.165.183 Sat Mar 31 20:10 - 22:25 (02:14)
ics311sp1820 pts/3 71.220.2.81 Sat Mar 31 19:07 - 19:07 (00:00)
cfs264sp1809 pts/6 73.228.165.183 Sat Mar 31 17:09 - 19:22 (02:13)
$
$ awk f mylogincheck myloginfile
cfs264sp1809 pts/5 73.228.165.183 Sat Mar 31 21:36 - 21:46 (00:10)
ics311sp1820 pts/3 71.220.2.81 Sat Mar 31 19:07 - 19:07 (00:00)
$
a) Please provide your script below (hint: Example 1 in AWK Handouts for week 7 can be used as a template)
b) Please provide the screenshot below:
5.5) Please use the solution to HW 7, hands-on problem 2, as a template to write a shell/awk script, called mymiddle3, that reads in three (3) numbers and then uses a self-defined function to determine the middle number in value. The middle number should be displayed in the main script, not inside the function you define. Please use the following testing cases to test your script:
$ ./mymiddle3 5 3 8
The middle number is 5.
$
$./mymiddle3 -2 -9 -7
The average is -7.
$
$ ./mymiddle3 8 3 8
The middle number is 8.
$
$ ./mymiddle3 0 -1 -1
The middle number is -1.
$
a) Please provide your script below along with a screenshot of the execution of the script:
b) Please provide the screenshot below:
image text in transcribed
Sprint 9:18 PMM 27% , metrostate.learn.minnstate.edu 2 of 2 PartI - Problem 2- Solution1: echo $2 $2 53 4 I ak "inThe largest number is "max1, $2, 3, 4" function ax(a, b, , d) f (a>. b 66 a >. c 66 a >. d } return a /myakmax8796 The largest aumber la The largest aunber is-6 . Solution 2: echo $1 2 3 S4 awk function maxia, b, , d 4 returntb else return c else return d yawknax48796 The largest nunber is s seyakax-8-6-9- The largest number is-6 Sprint 9:18 PMM 27% , metrostate.learn.minnstate.edu 2 of 2 PartI - Problem 2- Solution1: echo $2 $2 53 4 I ak "inThe largest number is "max1, $2, 3, 4" function ax(a, b, , d) f (a>. b 66 a >. c 66 a >. d } return a /myakmax8796 The largest aumber la The largest aunber is-6 . Solution 2: echo $1 2 3 S4 awk function maxia, b, , d 4 returntb else return c else return d yawknax48796 The largest nunber is s seyakax-8-6-9- The largest number is-6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions