Commit: 75516a3e1fad3fef81577730736e5956d694da6f Parent: 4936ba5975c71370be452e2819996b9af9d99b2f Author: Randy Palamar Date: Wed, 22 Sep 2021 21:33:08 -0600 deck2data: save some time by moving some sed commands to output for my current 1100 card deck: before this patch: time deck2data deck 0m02.38s real 0m03.36s user 0m00.73s system after this patch: time deck2data deck 0m02.03s real 0m02.70s user 0m00.55s system as the deck gets bigger I might look at more time saves Diffstat:
M | deck2data | | | 18 | +++++++++--------- |
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/deck2data b/deck2data @@ -18,14 +18,10 @@ deck=$(echo "$1" | cut -d '.' -f 1) while read line; do id=$(echo "$line" | cut -d $DELIM -f 1) path="$deck"/"$id" - front=$(smu "$path"/front.md | tr -d '\n' | rubify | - sed -e 's;src="\([^"]*\)";src="/_/'$path'/\1";g' \ - -e 's:/\>:>:g' -e 's:\<\(/audio\):<\1:g' \ - -e 's:\(/audio\)\>:\1>:g') - back=$(smu "$path"/back.md | tr -d '\n' | rubify | - sed -e 's;src="\([^"]*\)";src="/_/'$path'/\1";g' \ - -e 's:/\>:>:g' -e 's:\<\(/audio\):<\1:g' \ - -e 's:\(/audio\)\>:\1>:g') + front=$(smu "$path"/front.md | tr -d '\n' | + sed 's;src="\([^"]*\)";src="/_/'$path'/\1";g') + back=$(smu "$path"/back.md | tr -d '\n' | + sed 's;src="\([^"]*\)";src="/_/'$path'/\1";g') extra="$path"/extra.html if [ -f "$extra" ]; then @@ -35,4 +31,8 @@ while read line; do fi printf "%s\t%s\t%s\n" "$id" "$front" "$back" -done < $1 +done < $1 \ +| rubify \ +| sed -e 's:/\>:>:g' \ + -e 's:\<\(/audio\):<\1:g' \ + -e 's:\(/audio\)\>:\1>:g'