comm

Brent wants to find all developers common to cpp_developers.txt and rust_developers.txt and output them to common_developers.txt. Each developer is on 1 line in each file in this format: last_name.first_name

Show all commands he'll need to run on his Fedora Linux system.

  1. Change the current working directory to the directory where the two files are located: cd /path/to/files
  2. Use the comm command to find the lines that are common in both files:
    • sort cpp_developers.txt rust_developers.txt | uniq -d > common_developers.txt
    • The sort command sorts the lines in both files and passes them to the uniq command. The -d option tells uniq to only output lines that appear more than once.

      The > operator redirects the output to a file called common_developers.txt.

  3. View the contents of common_developers.txt to verify that the correct developers were found.
    • cat common_developers.txt
  4. Email the developers whose names are in the new file using the mail command or any other preferred email client.

Overall, the commands that Brent will need to run are:

cd /path/to/files
sort cpp_developers.txt rust_developers.txt | uniq -d > common_developers.txt
cat common_developers.txt

You should also read: