#!/bin/bash #find all text files (chapters), but nothing staring with an underscore for y in `ls *.txt | grep -v _.*`; do #first kill all the blank lines perl -p -e 's/^\n//g' $y > temp; #now add a tab so paragraphs are indented perl -pi -e 's/^/\n\t/g' temp; #finally, respect the section breaks within chapters perl -pi -e 's/-----/\n\n\n\n/g' temp; mv temp book/$y; #a2x -f chunked -d book book/book.asc --verbose #a2x -f pdf --fop -d book book/book.asc --verbose #git scribe gen [site|html|pdf|epub|mobi|all] done