#!/bin/bash for i in `cat nowcoder.txt`; do a=`echo $i | awk -F "" '{print length}'` if [[ $a -lt 8 ]]; then echo $i; fi done