正则笔记 Posted on 2008-05-17 In Linux 列出UA字符串: 1zcat log.gz |awk -F '""' '{print $2}'|sed -e 's/" .{1,}//g'|head 正则回逆引用: 12sed '/pattern/&/g' filesed '/(pattern)/1/g' file 向前匹配: 1perl -ne 'print if s/.*(?=pattern)/pattern2/' file