This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / 关于匹配,请帮帮忙
-turnip(turnip);
2005-4-4
{617}
(#2220503@0)
-
regular expression
-canadiantire(轮胎-M.I.N.K.);
2005-4-4
(#2220508@0)
-
Thanks, I know I can use regular expression, but don't know how to do
-turnip(turnip);
2005-4-4
(#2220516@0)
-
what language do you use?
-canadiantire(轮胎-M.I.N.K.);
2005-4-4
(#2220621@0)
-
under unix, can be ran within shell script or at command line. Thx!
-turnip(turnip);
2005-4-4
(#2220634@0)
-
Send me the file and $100, I will do it for you. Just kidding :D. Please see my scripts inside.If the file is exactly this way, you can use my script. Save the following scripts into awk.script. Suppose your file name is a.txt and you will generate b.txt. use this command: gawk -f awk.script <a.txt >b.txt
If your UNIX doesn't have gawk, use command awk.
It runs very fast. Isn't it worth $100? ;)
BEGIN{EMAIL="";NETMASK="";}
{if(NR%7==4){EMAIL=$5;sub(/\,/, "", EMAIL);}}
{if(NR%7==6){NETMASK=$3;}}
{if(NR%7==0){print $1 ";" $2 ":" NETMASK ";" EMAIL;EMAIL="";NETMASK="";}}
-benbenli(笨笨);
2005-4-4
{508}
(#2220930@0)
-
笨笨,你很聪明阿。不过输出的结果有点不对,我正在研究,NR%7==4 是什么意思
-turnip(turnip);
2005-4-4
(#2221119@0)
-
匹配不成功,由于以下原因:
-turnip(turnip);
2005-4-4
{587}
(#2221184@0)
-
别看我了. 如果不是一致的, 建议用C写程序吧.
-benbenli(笨笨);
2005-4-4
(#2221193@0)
-
不要用聪明形容我. 我试过了的啊. 什么不对法? 是不是你的文件和贴出来的不完全一样? 是不是文件前面有其他行? NR%7==4 是当前行号对7取模结果应为4.
-benbenli(笨笨);
2005-4-4
(#2221186@0)
-
用AWK吧。
-647i(倒行逆施);
2005-4-4
(#2221030@0)