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

Write the Linux command(s) you can use to accomplish the following tasks: Displa

ID: 3818873 • Letter: W

Question

Write the Linux command(s) you can use to accomplish the following tasks:

Displays the lines in a file named employees that are not repeated.

Displays repeated lines only in a file named employees

You want to create a file called f1nf2 with contents of two files, f1 and f2. Using the cat command how can you accomplish this task (show the command)?. Now assume that you want to add your name at the end of file f1nf2. What cat command can you use to accomplish this?

Try giving these two commands:

   echo cat

   cat echo

Explain the difference between the output of each command.

What is a .plan file?

TURN-IN.

Explanation / Answer

Displays the lines in a file named employees that are not repeated.
To display the lines that are not repeated, i.e., that are unique, we need to
first sort the lines in the file, the apply the command uniq.
So, the syntax is:
sort employees | uniq

Displays repeated lines only in a file named employees
To display the lines that are repeated, first sort the file, then apply the command uniq
with -d option, which lists all the duplicate lines in the file.
So, the syntax is:
sort employees | uniq -d

You want to create a file called f1nf2 with contents of two files, f1 and f2.
To copy the contents of both f1 and f2 to f1nf2, the command is:
Using the cat command how can you accomplish this task (show the command)?.
cat f1 f2 > f1nf2
Now assume that you want to add your name at the end of file f1nf2.
What cat command can you use to accomplish this?
To add your name at the end of file f1nf2, we should use an indirection operator >>.
cat >> f1nf2
command will leave you open to add a text at the command prompt. And whatever you typed
there will be appended to the file f1nf2.

echo cat will echo the text cat to the screen.

Where as cat echo will try to pick the file echo, and if not found ill return an error.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote