---
layout: page
author: Domenico Votta
category-page: advanced
category-title: Advanced commands
tags: compare sorted files
title: comm
---
The comm
is a command that compares two sorted files
line by line and writes the output: the lines that are in common and the lines that are unique.
Here we have two files named example1.txt
and
example2.txt
that contain 5 elements, to test this command:
example1.txt
{% highlight bash %}
Icecream
Chocolate
Cake
Candy
Biscuit
{% endhighlight %}
example2.txt
{% highlight bash %}
Bread
Chocolate
Tomato
Candy
Pizza
{% endhighlight %}
The syntax command is:
comm [flag][file1] [file2]
comm example1.txt example2.txt Icecream Chocolate Cake Tomato Candy Biscuit Pizza