請教shellscript parse [ 1, 2 ] 中數字 - Linux
By Christine
at 2011-10-22T19:34
at 2011-10-22T19:34
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.
--
: 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.
--
Tags:
Linux
All Comments
By Yedda
at 2011-10-24T05:03
at 2011-10-24T05:03
By Lucy
at 2011-10-26T15:17
at 2011-10-26T15:17
Related Posts
CentOS 5.3升級5.7
By Anthony
at 2011-10-22T02:04
at 2011-10-22T02:04
Gcin選字框在pcman與libreoffice中消失
By Belly
at 2011-10-21T19:53
at 2011-10-21T19:53
openSUSE的關機…
By Faithe
at 2011-10-21T19:26
at 2011-10-21T19:26
Apache2 VHost + Port Forwarding
By Olivia
at 2011-10-21T14:11
at 2011-10-21T14:11
ssh idle後會自動斷線但telnet不會...
By Mason
at 2011-10-21T14:03
at 2011-10-21T14:03