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

Data from password file: PLEASE WRITE USING UNIX COMMAND STRUCTURE! USING egrep

ID: 3871098 • Letter: D

Question

Data from password file:

PLEASE WRITE USING UNIX COMMAND STRUCTURE! USING egrep and pipes to output to stdout.

jwalberg:x 1025:1029:Justin Walberg:/home/students/jwalberg:/bin/bash rbabue1:x:1026:1030 Robin Babue:/home/students/rbabuel:/bin/bash dseller1:x:1027:1031: Derek Sellers:/home/students/dseller1:/bin/bash jhayes29:x:1028:1032:James Hayes:/home/students/jhayes29:/bin/bash tfloresu:x:1029:1033:Tomas Flores-Urrutia:/home/students/tfloresu:/bin/bash gromo1:x:1030:1034: Gabriel Romo:/home/students/gromo1:/bin/bash amuhume1:x: 1031:1035 AbdikaderMuhumed:/home/students/amuhume1:/bin/bash jcunni27:x:1032:1036: Joshua Cunningham:/home/students/jcunni27:/bin/bash adkika:x:1033:1037 Aimee Dkika:/home/students/adkika:/bin/bash ksteenba:x: 1034:1038 : Keary Steenbarger:/home/students/ksteenba:/bin/bash lmitch25:x:1035:1039:Laura Mitchell:/home/students/1mitch25:/bin/bash nwheele5:x:1036:1040:Nicholas Wheeler:/home/students/nwheele5:/bin/bash wloeffle:x 1037:1041:Wesley Loeffler:/home/students/wloeffle:/bin/bash amart127:x: 1038:1042:Alberto Martinez:/home/students/amart127:/bin/bash shoman3:x:1039:1043: Sara Homan:/home/students/shoman3:/bin/bash rgaughal:x:1040:1044: Robert Gaughan:/home/students/rgaughal:/bin/bash bherna11:x:1041:1045 Ben Hernandez:/home/students/bherna11:/bin/bash mtowner:x: 1042:1046 Maria Towner:/home/students/mtowner:/bn/bash embembat:x 1043:1047 Erick Mbembati:/home/students/embembat:/bin/bash tpfau:x:1044:1048 : Theodore Pfau:/home/students/tpfau:/bin/bash sdey1:x:1045:1049:Sadhana Dey:/home/students/sdeyl:/bin/bash bvukas:x:1046:1050:Brandon Vukas:/home/students/bvukas:/bin/bash gsmall:x:1047:1051:Garrett Small:/home/students/gsmall:/bin/bash emoore25:x:1048:1052:Edwin Moore:/home/students/emoore25:/bin/bash

Explanation / Answer

Below are the answer for the bullet points.

1. egrep -v "uucp | nobody | sync | nologin | halt" /etc/passwd

#You can add several users which are not required under the string after the egrep -v command, which will not show the particular user.

2. awk -F: '{print $1 "," $5}' /etc/passwd

3. sed "s/:/ /g" /etc/passwd

#Using sed to replace colon ":" with whitespace.

4.awk -F: 'match($1,/[A-Z]/){print $0}' /etc/passwd

#Since we do not want lower case we will match only with uppercase i.e [A-Z] and then print the whole row i.e. $0

According to the Chegg Forums, We can answer only 4 sub type questions, Sorry for the inconvenience caused.

Thanks for asking the question, Please let me know if you have any queries will be glad to help