题解 | #shell打印只有一个数字的行#
打印只有一个数字的行
http://www.nowcoder.com/practice/296c2785e64c46b7ae4c76bf190c2072
#! /usr/bin/env bash
########################################################
#
#
########################################################
function solution_2() {
local num=0
while read line; do
if [[ "${line}" =~ ^[^0-9]*[0-9]{1}[^0-9]*$ ]]; then
echo "${line}"
fi
done < nowcoder.txt
}
solution_2