Shell & Script Programming with UNIX 5.For this activity, use the file whodb pro
ID: 3875703 • Letter: S
Question
Shell & Script Programming with UNIX
5.For this activity, use the file whodb provided to you
pchen72 pts/0 2014-01-15 00:46 (174-26-130-129.phnx.qwest.net)
jmaszk pts/2 2014-01-15 09:47 (sslvpn.172-31-24-198.asu.edu)
bvbui pts/7 2014-01-16 14:12 (bbmobi.mobile.asu.edu)
mtcrowle pts/8 2014-01-16 11:46 (10.142.76.73)
mrchave3 pts/9 2014-01-16 14:58 (mc-pc.mobile.asu.edu)
cnorzaga pts/10 2014-01-16 14:58 (csn-laptop.mobile.asu.edu)
aarroyo3 pts/14 2014-01-16 15:13 (general2.asu.edu)
rarock pts/15 2014-01-16 15:01 (robbie-pc.mobile.asu.edu)
vtanders pts/16 2014-01-16 15:01 (vance-pc.mobile.asu.edu)
fgharo pts/17 2014-01-16 12:13 (en4081450114.etslabs.dhcp.asu.edu)
adelorme pts/18 2014-01-16 15:11 (austin-laptop.mobile.asu.edu)
bsleater pts/19 2014-01-16 15:05 (10.142.168.186)
ktnakas1 pts/20 2014-01-16 15:03 (samuel.mobile.asu.edu)
btlyons1 pts/21 2014-01-16 15:06 (10.140.117.129)
eakers pts/22 2014-01-16 15:06 (easton-aa08e7bb.mobile.asu.edu)
bammons pts/23 2014-01-16 15:06 (bammons21.mobile.asu.edu)
kuitche pts/24 2014-01-16 15:07 (prlta207i01.care.asu.edu)
stmarqu1 pts/25 2014-01-16 15:07 (seth-lap.mobile.asu.edu)
jsstrat1 pts/26 2014-01-16 15:12 (general2.asu.edu)
scamaren pts/27 2014-01-16 15:12 (medusa2.asu.edu)
dlcost pts/28 2014-01-16 15:13 (general.asu.edu)
jaguymon pts/29 2014-01-16 15:12 (otaku.mobile.asu.edu)
armolina pts/30 2014-01-16 15:12 (alex-laptop.mobile.asu.edu)
btlyons1 pts/31 2014-01-16 15:12 (general1.asu.edu)
aepittma pts/32 2014-01-16 15:12 (general2.asu.edu)
samuel pts/33 2014-01-16 15:12 (general.asu.edu)
swcooke pts/34 2014-01-16 15:12 (general.asu.edu)
cnorzaga pts/35 2014-01-16 15:12 (general1.asu.edu)
jtsmit11 pts/36 2014-01-16 15:12 (general.asu.edu)
djeverha pts/37 2014-01-16 15:13 (general2.asu.edu)
kdorer1 pts/39 2014-01-16 15:13 (10.140.115.255)
aarroyo3 pts/40 2014-01-16 15:13 (general1.asu.edu)
cdmurph2 pts/41 2014-01-16 15:13 (10.140.115.207)
ccolbou pts/0 2017-08-26 13:45 (68.2.235.50)
kwxue pts/1 2017-08-26 15:25 (10.141.12.243)
pearson pts/3 2017-08-26 06:34 (184.98.85.186)
lzhu61 pts/4 2017-08-26 14:43 (10.144.87.25)
avuong1 pts/5 2017-08-26 15:35 (10.152.100.245)
ramdisk pts/7 2017-08-22 17:17 (10.106.150.87)
xuehu pts/8 2017-08-26 11:30 (10.143.20.11)
zdienstb pts/9 2017-08-26 15:22 (70.162.164.21)
cschierb pts/10 2017-08-26 15:46 (104.167.172.229)
kuitche pts/11 2017-08-26 14:53 (10.152.112.188)
nfranks1 pts/12 2017-08-26 15:43 (70.176.114.211)
xchen308 pts/13 2017-08-26 13:22 (10.144.16.12)
dzebraus pts/14 2017-08-26 15:10 (64.53.153.77)
dzygadlo pts/15 2017-08-26 15:11 (184.101.72.51)
zcherla pts/16 2017-08-26 15:28 (70.176.115.184)
kagrawa2 pts/17 2017-08-26 15:48 (76.10.12.26)
kohamilt pts/18 2017-08-26 15:46 (45.21.39.213)
cdchapm2 pts/19 2017-08-26 14:30 (70.166.120.172)
lzhu61 pts/20 2017-08-26 14:09 (10.140.172.60)
bvenka19 pts/21 2017-08-26 15:47 (70.162.0.35)
cmadsen1 pts/22 2017-08-26 15:33 (68.99.202.50)
pkalungi pts/24 2017-08-26 15:00 (10.143.198.41)
mthakka2 pts/25 2017-08-26 15:47 (174.17.193.24)
avuong1 pts/26 2017-08-26 15:47 (10.152.100.245)
mdemare1 pts/28 2017-08-26 15:30 (68.2.58.74)
huahongt pts/0 2015-03-17 11:00 (r-laptop-pc.cidse.dhcp.asu.edu)
aalsham4 pts/1 2015-03-07 15:56 (en4085268.cidse.dhcp.asu.edu)
sbatra4 pts/3 2015-03-08 15:12 (:1.0)
samuelml pts/2 2015-03-17 07:49 (:pts/4:S.0)
mlsamuel pts/4 2015-03-17 07:49 (sslvpn.172-31-21-28.asu.edu)
mlsamuel pts/5 2015-03-17 07:50 (:pts/4:S.2)
jschmid8 pts/6 2015-03-17 11:25 (ultra.dhcp.asu.edu)
mburkhar pts/7 2015-03-17 12:35 (10.143.188.76)
mlsamuel pts/8 2015-03-17 07:49 (:pts/4:S.3)
mlsamuel pts/9 2015-03-17 07:49 (:pts/4:S.4)
kuitche pts/10 2015-03-17 12:41 (asup4084949.dhcpeast.asu.edu)
mlsamuel pts/11 2015-03-17 07:49 (:pts/4:S.1)
sbatra4 pts/12 2015-03-09 22:37 (:2.0)
ckurtz pts/14 2015-03-12 10:41 (seclnxvdi04.snm.asu.edu)
rbeerma pts/21 2015-03-17 11:36 (sslvpn.172-31-17-187.asu.edu)
skovatch pts/22 2015-03-17 10:42 (simona.mobile.asu.edu)
drynears pts/25 2015-03-17 10:48 (oked2228.mobile.asu.edu)
ramdisk pts/2 2016-11-28 20:22 (rmrds1.asu.edu)
admarkh1 pts/3 2016-11-30 13:55 (allendm23.mobile.asu.edu)
ybudiya pts/5 2016-11-30 06:22 (ip68-2-208-121.ph.ph.cox.net)
kuitche pts/6 2016-11-30 14:35 (en4106038.tps.dhcp.asu.edu)
ctestama pts/7 2016-11-30 13:07 (macbook-pro-3.dhcp.asu.edu)
jpeng31 pts/8 2016-11-30 14:03 (desktop-tgjm0un.mobile.asu.edu)
ctestama pts/10 2016-11-30 14:00 (macbook-pro-3.dhcp.asu.edu)
hhuang38 pts/11 2016-11-30 14:13 (casual_user.dhcp.asu.edu)
mtwerner pts/12 2016-11-30 14:17 (marks-yoga.mobile.asu.edu)
Find out who was logged into the system at 7am on 2015-03-17
Get the login info for the user “samuel”
How many unique users are logged in on a general machine
How many users are logged in more than once on a general machine?
For users logged into systems with known valid IP addresses, display usernames, date logged in (yyyy/mm/dd format) and IP address
7.Consider the address book below:
$ cat addr
Xiao Li, lxiao@unc.edu, 6705462234, Jackson, NC 764
Natkin William, wnatkin@imap28.vcu.edu, 8044344528, Richmond, VA 22345
Elizi Moe, emoe@ncsu.edu, 5208534566, Tempe, AZ 85282
Ma Ta, mta@yahoo.com, 4345667345, Austin, TX 91030
Diana Cheng, dcheng@asu.edu, 5203456789, Matitsi, WY 4587
Jackson Five, jfive@ncsu.edu, 5206564573, Kyenta, AZ 85483
Adi SrikanthReddy, sadi1@imap1.asu.edu, 6578904566, Wyo, WS 67854
Sort the addr file by phone number and print lines 1 thru 3.
8.Consider the address book below:
$ cat addr
Xiao Li, lxiao@unc.edu, 6705462234, Jackson, NC 764
Natkin William, wnatkin@imap28.vcu.edu, 8044344528, Richmond, VA 22345
Elizi Moe, emoe@ncsu.edu, 5208534566, Tempe, AZ 85282
Ma Ta, mta@yahoo.com, 4345667345, Austin, TX 91030
Diana Cheng, dcheng@asu.edu, 5203456789, Matitsi, WY 4587
Jackson Five, jfive@ncsu.edu, 5206564573, Kyenta, AZ 85483
Adi SrikanthReddy, sadi1@imap1.asu.edu, 6578904566, Wyo, WS 67854
Print the lines with imap number in the email address.
Print the lines that end with valid zip code
Print the lines that end with invalid zip code
9.Consider the address book below:
$ cat addr
Xiao Li, lxiao@unc.edu, 6705462234, Jackson, NC 764
Elizi Moe, emoe@ncsu.edu, 5208534566, Tempe, AZ 85282
Ma Ta, mta@yahoo.com, 4345667345, Austin, TX 91030
Diana Cheng, dcheng@asu.edu, 5203456789, Matitsi, WY 4587
Jackson Five, jfive@ncsu.edu, 5206564573, Kyenta, AZ 85483
Adi Srikanth Reddy, sadi1@imap1.asu.edu, 6578904566, Wyo, WS 67854
Natkin William, wnatkin@imap28.asu.edu, 8044344528, Richmond, VA 22345
Provide the sed command to:
Substitute the 3rd occurrence of “asu” in email address with “vcu”.
Remove all imap and imap number from the email addresses
Add the string “School Email” next to all email addresses ending with “.edu”
Move the email addresses to the end of the lines
10.Consider the files addr and errorCode below:
$ cat addr
Xiao Li, lxiao@unc.edu, 6705462234, Jackson, NC 764
Elizi Moe, emoe@ncsu.edu, 5208534566, Tempe, AZ 85282
Ma Ta, mta@yahoo.com, 4345667345, Austin, TX 91030
Diana Cheng, dcheng@asu.edu, 5203456789, Matitsi, WY 4587
Jackson Five, jfive@ncsu.edu, 5206564573, Kyenta, AZ 85483
Adi Srikanth Reddy, sadi1@imap1.asu.edu, 6578904566, Wyo, WS 67854
Natkin William, wnatkin@imap28.asu.edu, 8044344528, Richmond, VA 22345
$ cat errorCode
Error in the previous line.
Provide the sed command to insert the file errorCode after each line with invalid zip code.
Explanation / Answer
Question 5 requires the file whodb which isn't provided.
7) The addr file contains 5 columns namely Name, email, phone number, city, and state.
Here, we can use sort command along with -n and -k flag to sort the data according to the phone number. Note that -n flag sorts data according to the numerical value and -k sorts data or field according to the given column number. Then we would use head command to display the first 3 lines.
The entire command will be as follows:
$ sort - n -k3
$ head -3 addr
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.