Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Created January 8, 2014 20:47
Show Gist options
  • Save coderofsalvation/8324330 to your computer and use it in GitHub Desktop.
Save coderofsalvation/8324330 to your computer and use it in GitHub Desktop.
prints out the duplicate parts of 2 strings (bash function)
# prints out the duplicate parts of 2 strings
# @param string input1
# @param string input2
function stroverlap()
{
[ -z "$1" ] && return 1
[ -z "$2" ] && return 1
printf "%s\\n" $@ | awk 'x[$0]++'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment