Shell Scripting Knowledge Base

for loop that uses a sed file, send output to new file, and deletes empty lines

#!/bin/bash

for i in *.txt
do
	sed -i -f ../../../commands.sed *.txt
	done

if [ ! -f "../whole_chapter.txt" ]; then
    touch "../whole_chapter.txt"
fi

cat *.txt >> ../whole_chapter.txt
cp -v ../whole_chapter.txt ../whole_chapter~00.txt

sed -i '/^$/{N;/^\n$/D;}' ../whole_chapter.txt