Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Try:
- awk '{ if ($0 ~ /<p>[ ]*[0-9]+:[0-9]+/) { match($0, /[0-9]+/); print "<h1>Chapter " substr($0, RSTART, RLENGTH) "</h1>"; print $0; } else print; }'
- Invoke the above for all the files sending the output to some directory:
- for fname in *.htm *.html; do
- awk '{ if ($0 ~ /<p>[ ]*[0-9]+:[0-9]+/) { match($0, /[0-9]+/); print "<h1>Chapter " substr($0, RSTART, RLENGTH) "</h1>"; print $0; } else print; }' "${fname}" > "output/${fname}"
- done
- The name of the output directory name is assumed to be "output" in above.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement