Created
April 21, 2021 11:07
-
-
Save jfdm/3a4c6d37cb0f8679bc213fbdcc5e2a01 to your computer and use it in GitHub Desktop.
Count words in a rebuttal, and show first n words that are not blockquotes and headings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# $1 first n words | |
# $2 the rebuttal. | |
echo "## WC" | |
grep -vE -e "^>" $2 | grep -vE -e "^#" | uniq | wc -w | |
echo "" | |
echo "## TeX Count" | |
grep -vE -e "^>" $2 | uniq | texcount -1 - | |
echo "## First $2 words" | |
grep -vE -e "^>" $2 | grep -vE -e "^#" | gawk -v c=$1 -v RS='[[:space:]]+' -- 'NR<=c{ORS=(NR<c?RT:"\n");print}' - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment