diff --git a/fromtext.sh b/fromtext.sh new file mode 100755 index 0000000..82367e7 --- /dev/null +++ b/fromtext.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +SEP='\t' +COLUMNS='4 5' + +main() { + while read -r line; do + filename= + i=0 + for c in $COLUMNS; do + f="$(echo "$line" | awk -F$SEP "{print \$$c}")" + [ -z "$f" ] && continue + if [ "$filename" = '' ]; then + filename="$(echo "$f" | tr '[:upper:]' '[:lower:]' | sed -e 's/ /-/g' -e 's/[^a-z0-9-]//g')" + fi + echo "$f" > "$filename.$i.md" + i=$((i+1)) + done + done +} + +main "$@"