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

Which two Unix commands can we apply to create patches to convert one version of

ID: 3586774 • Letter: W

Question

Which two Unix commands can we apply to create patches to convert one version of a file (or files) to another version?

Select one:

a. $ cut and $ paste

b. $ diff and $ comm

c. $ comm and $ patch

d. $ cut and $ comm

e. $ diff and $ patch

How can you display the non-printing characters in a text file called 'spam.txt' while using Unix?

Select one:

a. $ cat -display spam.txt

b. $ cat > spam.txt

c. $ cat -s spam.txt

d. $ cat -D spam.txt

e. $ cat -A spam.txt

If a file is tab-delimited, why is it best to use $ cut to extract fields rather than characters?

Select one:

a. $ cut does not perform well on character extraction.

b. Each line may contain different number of characters.

c. Calculating character positions within the line is easy.

d. $ cut does not provide an option to extract characters.

Which command does the opposite of $ cut? Rather than extracting a column of text from a file, it adds one or more columns of text to a file.

Select one:

a. $ comm

b. $ paste

c. $ join

d. $ add

e. $ copy

What does the option "-k 3.7" mean in a $ sort command?

Select one:

a. Use a sort key that begins at the 3rd field and ends at the 7th field

b. Use a sort key that begins at the 3rd character and ends at the 7th character

c. Use a sort key that begins at the 7th character within the 3rd field

d. Use a sort key that begins at the 3rd character within the 7th field

Explanation / Answer

(1) The two commands used to create patches and convert one version of file to another are:

(a) Cut and Paste

Syntax:

2. $ cat -v spam.txt is used to display non-printing characters in a file while using Unix. It is not mentioned in the options given. But this is the require command.

3. (c) Calculating character position within the line is easy. Since, if a file is tab-delimited, cut command is used for cutting one of several columns from a file (often a log file) to create a new file. If character position within a file is known, then it will be easy to cut a file to create a new file.

4. (b) paste: The opposite of cut command to add one or ore columns in unix.

5. (a) sort -k 3.7: It sorts the file begining from third field and ending at seventh field.