简体   繁体   中英

How to count distinct DN from BIND REQ in multiple files?

for various files whose name start with access i wan to Find all the " BIND REQ" and count and distinct the values of the content of the dn=" " to get the top 20 most counted lines.

Example of the lines in the files that start with BIND REQ, hope you can help

BIND REQ conn=28930689 op=0 msgID=2033918 type=SIMPLE dn="uid=00450101008Aut,ou=People,o=tel" version=2

i was trying something like

awk -v RS='dn=" |"' 'NR==2{gsub(/\n/,"");gsub(/,/,"\n");print}' access

but got:

uid=55533

We did: grep " BIND REQ" access* |awk -F" '{print $2}' | sort | uniq -c | sort -rn | more

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM