标题:
怎样查找*.txt文件中任意位置与任意的IP地址呢?
[打印本页]
作者:
ybxcyx
时间:
2007-12-30 21:24
标题:
怎样查找*.txt文件中任意位置与任意的IP地址呢?
我想学习查找与替换IP地址的方法,假如文件a.txt内容如下:
shshshshsyyyuwuwfaaf192.168.0.1dhdhhddhhdhdhdh
hshshshshshshxffxsssssssfxf192.167.10.190hhhhgsgsggsgsg
怎样不必利用文件中的ip本身,就能查到提取地址,并且替换呢?
作者:
junchen2
时间:
2007-12-31 12:23
awk "{d=gensub(/[^0-9\.]/,\"\n\",\"g\",$0);print d}" test.txt | awk -F"\056" "{if(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/){if(length($1)<4&&length($2)<4&&length($3)<4&&length($4)<4&&$1<256&&$2<256&&$3<256&&$4<256)print $0}}"
欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/)
Powered by Discuz! 2.5