把一个文本文档中只有一个数字的行给打印出来
题目要求
用shell实现,把一个文本文档中只有一个数字的行给打印出来。
参考答案
#!/bin/bash while read line do n=`echo $line |sed 's/[^0-9]//g'|wc -L` if [ $n -eq 1 ] then echo $line fi done < 1.txt
题目要求
用shell实现,把一个文本文档中只有一个数字的行给打印出来。
参考答案
#!/bin/bash while read line do n=`echo $line |sed 's/[^0-9]//g'|wc -L` if [ $n -eq 1 ] then echo $line fi done < 1.txt