Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- gawk '{gsub(/\n\n+/,"\n\n");printf $0}' RS="^$" file | sed '
- s/\s*\([.,;!?]\)\s*/\1 /g
- s/\s\+/ /g
- s/^.*$/\L&/
- s/\([.;!?]\s*\)\(.\)/\1\u\2/g
- s/^./\u&/
- /\(^$\)\|\([!?;.,]\s*$\)/! s/\s*$/.&/
- '
- gawk 'END{print "Number of paragraphs: "NR}' RS="" file
- gawk -F'[.?;!]' 'END {print "Number of sentences: "NF-1}' RS='^$' file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement