#!/bin/sh -e
#
# unspace - replace contents of clipboard with something in ascii w/o spaces

set -x

pbpaste | /usr/bin/perl -pe 's/[^[:ascii:]]/-/g' \
  | sed 's/[ ,][ ,]*/_/g' \
  | sed -e 's/^[ ]*//' -e 's/[ ]*$//' -e 's/^_//' -e 's/_$//' | pbcopy

{
  set +x
} 2>/dev/null
