#!/bin/bash # # Demonstrate the use of a regular expression to detect blank lines in a file, # and those containing only whitespace # re="^[[:digit:]]+[[:blank:]]*$" while read -r line; do [[ $line =~ $re ]] && continue echo "$line" done < <(cat -n "$0")