From 9b3ba123f62ffbe8abd70e6c2f08a8689af1849b Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Mon, 29 Nov 2021 21:33:34 -0300 Subject: [PATCH] Remove old fsub --- local/bin/fsub | 59 -------------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100755 local/bin/fsub diff --git a/local/bin/fsub b/local/bin/fsub deleted file mode 100755 index c347849..0000000 --- a/local/bin/fsub +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh -set -e - -FSUBRC=~/.config/fsubrc - -usage() { - echo "usage: fsub " - echo "fsub expects $FSUBRC to have a blacklist of words" - exit 1 -} - -[ -z "$1" ] && usage - -for arg in "$@"; do - case "$arg" in - *.srt ) - if [ ! -f "$arg" ]; then - echo "$arg is not a file" - usage - fi ;; - *) echo "$arg is not a .srt file"; usage ;; - esac -done - -[ -f "$FSUBRC" ] || touch $FSUBRC - -for arg in "$@"; do - awk ' - BEGIN { - n = 1 - i = 0 - while(getline < "'$FSUBRC'") { - blacklist[i] = $0 - i++ - } - } - /^[[:digit:]]+[[:space:]]*$/ { - getline - time = $0 - - linen = 0 - while(getline) { - lines[linen] = $0 - linen++ - if($0 ~ /^[[:space:]]*$/) break - } - - for(j = 0; j < i; j++) - for(k = 0; k < linen; k++) - if(lines[k] ~ blacklist[j]) next - - print n - n++ - print time - for(j = 0; j < linen; j++) - print lines[j] - }' "$arg" | sed 's/\r//' > /tmp/fsub - mv /tmp/fsub "$arg" -done