QUESTION 1 grep the NIS passwd file for my (fveglian) entry. To do this, execute
ID: 3910989 • Letter: Q
Question
QUESTION 1
grep the NIS passwd file for my (fveglian) entry. To do this, execute:
ypcat passwd | grep 'fveglian'
What is the value of my UID?
10000
0
10010
200
10 points
QUESTION 2
Use the command called id and determine ALL of the UNIX groups that I belong to. See the man page for the id command for help on this.
What UNIX group(s) do I belong to?
120 and 200
200 and 212
250 and 200
10010 and 200
10 points
QUESTION 3
What is the primary group ID (GID) of the user called root? Consult the local /etc files on the cyberserver server. Do not use the ypcat command.
10 points
QUESTION 4
There is a file called yppasswd in my home directory. It is a copy of the NIS passwd file.
Use the grep command to determine how many users are in the group 204.
How many users are in the 204 group?
10 points
QUESTION 5
cd to my home directory
Create a regular expresssion that when used within a grep command string will search the contents of the file called autos and output only the following lines:
chevy camaro 96 15000
cadillac catera 98 34000
What regular expression will output the above 2 lines?
'c[ha]'
'^c.* 9[6]'
'c.* c.*'
'chev .*'
10 points
QUESTION 6
Using the autos file again, define a regular expression that, when used with thr grep command, will generate the following output:
ford taurus 97 19000
honda accord 96 12000
A) Which regular expression when used within a grep command will output the above 2 lines?
'^[fh].* [t].*'
'[fh] *.*'
'9[67]'
'or'
10 points
QUESTION 7
cd to my home directory.
Using grep, locate all of the lines that begin with the character s within the file called grepfile.
What grep command string will do this?
grep 's' grepfile
grep '^s' grepfile
grep '$s' grepfile
grep 's' grepfile
10 points
QUESTION 8
cd to my home directory.
Using grep, output only the lines that contain a $ within the file called grepfile. Use the grep command to locate and number each line that is located.
Remember: there is a difference between counting the lines of output and numbering the lines of output.
What grep command string did you use?
grep '$' grepfile
grep -c '$' grepfile
grep -n '$$' grepfile
grep -n '$' grepfile
10 points
QUESTION 9
cd to my home directory.
Create a regular expression that, when used with the grep command, will output only the lines that end with a period (.) within the file called grepfile.
Which regular expression will do this? There is only one.
(When entering your answer, enter only the regular expression part and include the single quotes at the begining and the end.
Only 2 lines should be output once you determine the correct regular expression.)
10 points
QUESTION 10
Replace the ## to complete the regular expression.
cd to my home directory. Replace the ## to complete the regular expression that when the command is executed will generate the following output from the file called regexp?
Expression
expression
The command is: grep '^[##]xpr.*n' regexp
Which characters must replace the ## to generate the requested output above?
(Enter only the 2 characters in your answer.)
10000
0
10010
200
Explanation / Answer
Solution: - Question 1, Question 2 and Question 4 can not be answered properly because whatever configuration your server has,, I cannot determine or I cannot run those command in my server to check those outputs. Rest of the questions have been answered properly with explanations.
Question 3
Ans) the primary group id of user root is always 0.
Question 5:
Ans) grep 'c[ha]' autos
Here we are using wild "[]" so it check any of the character present in those braces.
Question 6:
Ans) grep 'or' autos
Here it will check for the patern or in the lines of the files. Both "ford" and "accord" have "or" present in it.
Question 7:
Ans)grep '^s' grepfile
here '^s' states that it will only check for those line that begins with s.
Question 8:
Ans) grep -n '$' grepfile
Here -n switch gives the number line along with the output and "" is the escape character used to search '$'.
Question 9:
Ans) grep '.$' grepfile
Here "" is the escape character used and ".", "$" is used to see the lines that ends with period(.)
Question 10:
Ans) It will check for that given pattern and it is replaced by 'E' and 'e' along with the given patten to give the output.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.