請教shellscript parse [ 1, 2 ] 中數字 - Linux

Table of Contents

※ 引述《guessi (沒)》之銘言:
: echo "x [ 12, 34 ]"|sed 's/[^0-9]/ /g'|awk '{print$1==$2?"equal":"not equal"}'

echo "asdfwer [ 1234, 3456 ]" | sed 's:[^0-9]*\([0-9]*\)[^0-9]*\([0-9]*\)[^0-9]*:\1 -eq \2:' | xargs test || echo 'not eq'

--
In heaven, all the interesting people are missing.


--

All Comments

Yedda avatarYedda2011-10-24
我都忘了有test這好東西了...Orz
Lucy avatarLucy2011-10-26
感謝大大 最近沒啥時間測試東西Orz 晚點來試試看!!!