Question: Identify the grep/egrep command, options, and regular expression needed to produce the output described from the sample /etc/passwd file given below. Also identify the number

Identify the grep/egrep command, options, and regular expression needed to produce the output described from the sample /etc/passwd file given below. Also identify the number of lines that match the criteria. Review the man page for the /etc/passwd configuration file (man 5 passwd) to find out more information about the layout of the /etc/passwd file. Use regular expression formats, not specific file entries or line numbers, within your single grep/egrep command. You will need to understand how to use a field delimited file as practiced in the Hands On Activities for this unit. Lines below:

daemon:x:2:2:Daemon 1001:/sbin:/bin/bash ftp:x:40:49:FTP export account:/srv/ftp:/bin/bash daemonuser:x:50:59:nouser/bin/false:/home/nouser:/bin/bash gdm:x:106:111:Gnome Display Mgr daemon:/var/lib/gdm:/bin/false haldaemon:x:101:102:User for haldaemon:/var/run/hald:/bin/false lp:x:4:7:Printing daemon:/var/spool/lpd:/bin/bash mail:x:8:12:Mailer daemon:/var/spool/clientmqueue:/bin/false root:x:0:0:root:/root:/bin/bash sshd:x:71:65:SSH daemon:/var/lib/sshd:/bin/false olivert:x:1001:1005:Tom Oliver:/home/olivert:/bin/csh smiths:x:1049:1000:Sue Williams:/export/home/smiths:/bin/csh northj:x:1003:1003:Jim jones-North:/home/northj:/bin/csh denniss:x:1005:1003:Sue Dennis:/home/denniss:/bin/bash smitha:x:1050:1001:Amy Smith:/export/home/smitha:/bin/bash jonesc:x:1053:1001:Cathy Jones:/export/home/jonesc:/bin/ksh smithd:x:1055:1001:Dan Smith Jr:/export/home/smithd:/bin/csh

Question:

1a.Display the lines from /etc/passwd that have primary group IDs of 1001 or 1003 (4th field):

1b.Display the lines from /etc/passwd that have daemon as part of their user name (1st field):

1c.Display the lines from /etc/passwd that do not have their home directory (6th field) in /export/home:

1d.Display the line count of matches from /etc/passwd that have (case insensitive) Smith or Jones in their description (5th field):

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!