当前位置: 技术问答>linux和unix
帮忙用awk解析一下以下字符串的表达式 多谢 急~
来源: 互联网 发布时间:2016-12-07
本文导语: 表达式条件: (("ct=eggs" && "egg_id=" && ("ac=hatch" || "goods_id=") ) || ("ct=intimacy" && "ac=ml") || ("ct=macth" && "ac=macth") || ("ct=heaven" && "dog_id") || ("ct=mydogs2" && ("ac=walk" || "ac=stopWalkDog"))) 原字符串: 192.168.0.1 - - [16/Jun...
表达式条件:
(("ct=eggs" && "egg_id=" && ("ac=hatch" || "goods_id=") ) || ("ct=intimacy" && "ac=ml") || ("ct=macth" && "ac=macth") || ("ct=heaven" && "dog_id") || ("ct=mydogs2" && ("ac=walk" || "ac=stopWalkDog")))
原字符串:
192.168.0.1 - - [16/Jun/2011:14:03:34 -0500] "POST /aigo/?app=dog-marry&showiframe=1&rand=51260872&nextUrl=74.86.248.252%3A81&ct=dogshop&ac=index&do=sell&=&PHPSESSID=28622b5fdf27df4f68804c1810327791&xdogskey=12656304461107022258826054951087731745638 HTTP/1.1" 200 1521
192.168.0.1 - - [16/Jun/2011:14:03:40 -0500] "POST /aigo/?app=dog-marry&showiframe=1&rand=46045890&nextUrl=208.43.196.221%3A81&ct=intimacy&=&PHPSESSID=45993186793ad14bec398fc1b2a04f39&xdogskey=10442172461608700377650326589550915462035 HTTP/1.1" 200 1534
192.168.0.1 - - [16/Jun/2011:14:03:46 -0500] "POST /aigo/?app=dog-marry&showiframe=1&rand=72905739&nextUrl=74.86.248.252u00253A81&ct=mydogs2&ac=hotel&=&PHPSESSID=d906eaaa6c5e591baa762fdb8114ec69&xdogskey=1046715844142051232701078353443914613478 HTTP/1.1" 200 3568
(("ct=eggs" && "egg_id=" && ("ac=hatch" || "goods_id=") ) || ("ct=intimacy" && "ac=ml") || ("ct=macth" && "ac=macth") || ("ct=heaven" && "dog_id") || ("ct=mydogs2" && ("ac=walk" || "ac=stopWalkDog")))
原字符串:
192.168.0.1 - - [16/Jun/2011:14:03:34 -0500] "POST /aigo/?app=dog-marry&showiframe=1&rand=51260872&nextUrl=74.86.248.252%3A81&ct=dogshop&ac=index&do=sell&=&PHPSESSID=28622b5fdf27df4f68804c1810327791&xdogskey=12656304461107022258826054951087731745638 HTTP/1.1" 200 1521
192.168.0.1 - - [16/Jun/2011:14:03:40 -0500] "POST /aigo/?app=dog-marry&showiframe=1&rand=46045890&nextUrl=208.43.196.221%3A81&ct=intimacy&=&PHPSESSID=45993186793ad14bec398fc1b2a04f39&xdogskey=10442172461608700377650326589550915462035 HTTP/1.1" 200 1534
192.168.0.1 - - [16/Jun/2011:14:03:46 -0500] "POST /aigo/?app=dog-marry&showiframe=1&rand=72905739&nextUrl=74.86.248.252u00253A81&ct=mydogs2&ac=hotel&=&PHPSESSID=d906eaaa6c5e591baa762fdb8114ec69&xdogskey=1046715844142051232701078353443914613478 HTTP/1.1" 200 3568
|
试试逐个提取变量的值
比如,对于ac
sed 's/&/n/g' yourfile|awk -F= '/ac=/ {print $2}'
比如,对于ac
sed 's/&/n/g' yourfile|awk -F= '/ac=/ {print $2}'