Skip to content

Instantly share code, notes, and snippets.

@alpay
Last active December 16, 2018 13:32
Show Gist options
  • Save alpay/36b0070c85e78923bfa2971da7286193 to your computer and use it in GitHub Desktop.
Save alpay/36b0070c85e78923bfa2971da7286193 to your computer and use it in GitHub Desktop.
Finding Case-Insensitive Duplicates

Finding Case-Insensitive Duplicates

This will give you a list of duplicate lines which you can then investigate further.

tr 'A-Z' 'a-z' < filename | sort | uniq -d


  • Example Data File: numbers.txt
one
One
oNe
two
three
> 'A-Z' 'a-z' < numbers.txt | sort | uniq -d
> one
  • You could then grep for related line numbers like so:

grep --ignore-case --line-number one numbers.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment