Hello,
I am trying to write a script that will count the number of characters for each line in a file and all the lines that have less than 80 characters and that are ending with a period, I want it to insert a blank line after them immediately. But, for whatever reason the condition if [[ "$len" -lt "$MINLEN" && "$line" =~ \[*\.\] ]] is not evaluated. So, nothing happens to the file. It just prints the line as is . It does not add the blank space after a line that has less than 80 characters and that end with a period. Can you please help me?
#!/bin/bash
MINLEN=80
# Assume lines shorter than $MINLEN characters ending in a period
#+ terminate a paragraph.
while read line
do
echo "$line"
len=${#line}
if [[ "$len" -lt "$MINLEN" && "$line" =~ \[*\.\] ]]
then echo
fi
done
exit