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.
- Change the current working directory to the directory where the two files are located: cd /path/to/files
- 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 theuniq
command. The-d
option tellsuniq
to only output lines that appear more than once.The
>
operator redirects the output to a file calledcommon_developers.txt
.
- View the contents of
common_developers.txt
to verify that the correct developers were found.- cat common_developers.txt
- 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