projects
/
BK-2020-03.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat(user/zeropad.sh):Only rename files that need renaming
[BK-2020-03.git]
/
unitproc
/
bkt-decimate
diff --git
a/unitproc/bkt-decimate
b/unitproc/bkt-decimate
index 47db83f0b1f26480a67c6fedf5527965df9b96ad..855ab0c71b8c88ec9f56ccf6f9a864b09794419c 100644
(file)
--- a/
unitproc/bkt-decimate
+++ b/
unitproc/bkt-decimate
@@
-2,7
+2,7
@@
decimate() {
# Desc: Randomly remove 10% of stdin lines
decimate() {
# Desc: Randomly remove 10% of stdin lines
- # Depends:
GNU Coreutils 8.32 (shuf
)
+ # Depends:
Bash 5.1.16; GNU Coreutils 8.32 (shuf, nl, head, sort, cut
)
# Version: 0.0.1
# Read lines
# Version: 0.0.1
# Read lines
@@
-12,6
+12,7
@@
decimate() {
lc="${#lines[@]}";
lk="$((lc * 900 / 1000))";
lc="${#lines[@]}";
lk="$((lc * 900 / 1000))";
+ # Output
printf "%s\n" "${lines[@]}" | \
nl -w1 -s' ' | \
shuf | \
printf "%s\n" "${lines[@]}" | \
nl -w1 -s' ' | \
shuf | \