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

QUESTION 1 Complete the sed command line string that will delete line 7 through

ID: 3913311 • Letter: Q

Question

QUESTION 1

Complete the sed command line string that will delete line 7 through line 11 inclusively from the file called sedfile.

sed '#,11d' sedfile

What would you replace the # with to complete the sed command string above?

6

7d

7

11

10 points   

QUESTION 2

Complete the sed commmand string below.

Create a sed command line string that will replace ALL the occurrences of X and x with s within the file called sedfile.

sed 's/####/s/g' sedfile

Replace the #### with the correct answer.

[Xandx]

Xx

X,x

[Xx]

10 points   

QUESTION 3

Which sed command line string will delete any line that begins with the string 'directory' within the file called sedfile.

sed '/dir/d' sedfile

sed '/^dir/d' sedfile

sed 's/^dir/d' sedfile

sed '/directory/d' sedfile

10 points   

QUESTION 4

Take a look at the file called ~fveglian/dear.john. You want to replace the name "Mary" with "Sue" anywhere it appears on lines 2 through 7.

The following command will replace all occurrences of "Mary" with "Sue" in lines 2 through 7?

sed '2,7s/Mary/Sue/g' dear.john

True

False

10 points   

QUESTION 5

Change directory to my home directory. Execute the following sed command string.

sed '/^$/d' sedfile

Will this command remove all of the blank lines from the output of the command?

Yes
No

10 points   

QUESTION 6

cd to my home directory. Consider the following sed command string.

sed '3,$s/Hallowein/Halloween/' halloween

Will the above command string replace ALL the occurences of Hallowein with Halloween from line 3 to the end of the file in the file called halloween?

Yes
No

10 points   

QUESTION 7

cd to my home directory. Execute the following sed command string.

ls -l | sed '/^d/d'

What does the sed command string do?

Outputs the contents of the directory but, deletes all blank lines from the output.

Outputs the contents of the directory but, deletes all lines that contain filenames from the output.

Outputs the contents of the directory but, deletes all references to sub-directories from the output.

Outputs the contents of the directory.

10 points   

QUESTION 8

cd to my home directory.

Will the following command generate a list of the group names only from the file called sortfile and display the list to the terminal?

awk -F! '{ print $3 }' sortfile

The group names are located in column three of the file.

Yes
No

10 points   

QUESTION 9

cd to my home directory.

Commands such as awk, sort, grep and more, can be used as a filter. These commands are considered filters when used to the right of a pipe.
Using awk and the sort command, construct a command string that will reference the file called sortfile and output ONLY the user names in reverse sorted order. The user names are those found in column 1.

Will the following command achieve the above result?

awk -F! '{ print $1 } ' sortfile | sort -r

Yes
No

10 points   

QUESTION 10

cd to the ~fveglian/midterm directory. Using awk, generate an output that contains the file entry names and file type/permissions only of the file entries within the directory.

Separate the file entry names and file type/permissions columns by a colon (:).

The output should resemble the following:

filename : permissions

Replace the ## below to create a sed command string that will generate the output requested above.

ls ## | awk '{ print $9 ":" $1 }'

-A

-F

-l

-r

10 points   

Click Save and Submit to save and submit. Click Save All Answers to save all answers.

6

7d

7

11

Explanation / Answer

Please Note: You have posted more than one Question. According to Chegg Answering Guidelines, I have answered the first question. Please Post Separate for other Questions.

QUESTION 1

Complete the sed command line string that will delete line 7 through line 11 inclusively from the file called sedfile.

sed '#,11d' sedfile

What would you replace the # with to complete the sed command string above?

6

7d

7

11

Answer)

To form a sed command line string that will delete line 7 through line 11 inclusively from the file called sedfile:

sed '7,11d' sedfile

The above command will delete line 7 through line 11 inclusively from the file called sedfile.

Thus the correct answer is:

c) 7

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote