Skip to content

Instantly share code, notes, and snippets.

@joeljuca
Created February 2, 2022 23:17
Show Gist options
  • Save joeljuca/24ccc07fcbd416b84abc56c4cb39e188 to your computer and use it in GitHub Desktop.
Save joeljuca/24ccc07fcbd416b84abc56c4cb39e188 to your computer and use it in GitHub Desktop.
function number-only() {
if test ! -t 0; then
strlen "$(</dev/stdin)"
else
echo -n $@ |
xargs |
sed -E "s/[^0-9]+//g"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment