feat(user/transcribe_whisper.sh):Add mp3 transcription script
[BK-2020-03.git] / unitproc / bkt-decimate
1 #!/bin/bash
2
3 decimate() {
4 # Desc: Randomly remove 10% of stdin lines
5 # Depends: Bash 5.1.16; GNU Coreutils 8.32 (shuf, nl, head, sort, cut)
6 # Version: 0.0.1
7
8 # Read lines
9 mapfile -t lines;
10
11 # Calc lines to keep, lk
12 lc="${#lines[@]}";
13 lk="$((lc * 900 / 1000))";
14
15 # Output
16 printf "%s\n" "${lines[@]}" | \
17 nl -w1 -s' ' | \
18 shuf | \
19 head -n "$lk" | \
20 sort -n -k1,1 | \
21 cut -d' ' -f2- ;
22 }; # randomly eliminate 10% of lines
23
24 echo "$WARNING:This is a Bash function definition."