Skip to content

Instantly share code, notes, and snippets.

@valvallow
Created December 14, 2011 12:22
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save valvallow/1476377 to your computer and use it in GitHub Desktop.
toothless number list
#!/bin/sh
# toothless
VALUE_START_NUMBER=0
while getopts hs: OPT
do
case $OPT in
"s" ) VALUE_START_NUMBER="$OPTARGS" ;;
"h" ) echo 'Usage: toothless [-s] <file>'; exit 0 ;;
esac
done
cat $1 | awk 'BEGIN{pre='$VALUE_START_NUMBER';}{if(pre+1<$1){for(i=pre+1;i<$1;i++){skip=0;print i;}}{skip=!skip}pre=$1;}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment