[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
some suggest about \.
From: |
者 测试 |
Subject: |
some suggest about \. |
Date: |
Mon, 8 Mar 2004 18:00:07 +0800 (CST) |
$awk --version
GNU Awk 3.1.1
Copyright (C) 1989, 1991-2002 Free Software
Foundation.
$cat iplog.txt
192.168.2.123 user1
192.168.2.123 user4
192.168.2.73 user2
119/168.2.66 user6
###### note: the 4th line input error on purpose to
test the awk-script.
$cat iplog.txt | awk --re-interval '{
if($1 ~
"^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$")
{print "input right!",$0;}
else {print "input wrong!",$1;}
}'
#-------------------------
I always fail to test the 4th line.
Final I found I must replace "\." with "[.]".
I hope you can set "\." equal a real dot.
Many thanks to you.
_________________________________________________________
Do You Yahoo!?
完全免费的雅虎电邮,马上注册获赠额外60兆网络存储空间
http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.mail.yahoo.com