Skip to content

Commit 664e939

Browse files
committed
Adds function numeric-only
1 parent 0b053dd commit 664e939

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/numeric-only.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) 2018 Joel Wallis Jucá <[email protected]>
3+
# ISC licensed
4+
5+
# Strips all non-numeric characters from passed arguments
6+
function numeric-only {
7+
echo -n "$@" \
8+
| xargs \
9+
| sed -E "s/[^0-9]+//g"
10+
}

0 commit comments

Comments
 (0)