- 论坛徽章:
- 0
|
- [root@myhost test]# cat c.awk
- BEGIN{
- FS="&"
- }
- function anlzz(x)
- {
- a=""
- if (x~/pid=/){a=a"pid "gensub(/.*pid=([^&]+).*/,"\\1",1,x)}else{a=a"- -"}
- if (x~/type=/){a=a" type "gensub(/.*type=([^&]+).*/,"\\1",1,x)}else{a=a" - -"}
- if (x~/Sortid=/){a=a" srotid "gensub(/.*Sortid=([^&]+).*/,"\\1",1,x)}else{a=a" - -"}
- if (x~/Themeid=/){a=a" Themeid "gensub(/.*Themeid=([^&]+).*/,"\\1",1,x)}else{a=a" - -"}
- if (x~/offid=/){a=a" offid "gensub(/.*offid=([^&]+).*/,"\\1",1,x)}else{a=a" - -"}
- if (x~/page=/){a=a" page "gensub(/.*page=([^&]+).*/,"\\1",1,x)}else{a=a" - -"}
- if (x~/from=/){a=a" from "gensub(/.*from=([^&]+).*/,"\\1",1,x)}else{a=a" - -"}
- return a
- }
- {print anlzz($0)}
复制代码 awk -f c.awk filename
[ 本帖最后由 nuclearxin 于 2008-3-25 14:29 编辑 ] |
|