Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
VARIABLE=`grep PortNumber` testfile.txt | awk -F'"' '{print $2}'` echo $VARIABLE 33111
我想检查以确保变量的前 2 个数字仅为数字“3”。
如何使用标准的 ksh 脚本来做到这一点?
编辑:我想我在下面有它,这看起来正确吗?回声 $VARIABLE | egrep -q '^[3]{2}'
你可以做 :
echo $VARIABLE | grep -E "^3+{2}"