Uniq
The uniq
command in Linux is a command line utility that removes repeated
lines in a file or supplied text. In other words the uniq
tool helps detect
and delete adjacent duplicate lines of text.
For example this command:
awk -F "/" '/^\// {print $NF}' /etc/shells | sort
Will output:
bash bash fish fish git-shell sh sh
If we take that same command and pipe it into uniq
:
awk -F "/" '/^\// {print $NF}' /etc/shells | sort | uniq
We get:
bash fish git-shell sh