Skip to content

Instantly share code, notes, and snippets.

@bgstack15
Created October 11, 2017 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgstack15/99a4bcf6618294986de33e94b4e65746 to your computer and use it in GitHub Desktop.
Save bgstack15/99a4bcf6618294986de33e94b4e65746 to your computer and use it in GitHub Desktop.
Convert input sets of numbers into numerical sequences
convert_to_seq() {
printf "${@}" | xargs -n1 -d',' | tr '-' ' ' | awk 'NF == 2 { system("/bin/seq "$1" "$2); } NF != 2 { print $1; }' | xargs
}
convert_to_seq "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment