cmd
C:
cd c:\tmp\
c:\tmp>for /f "tokens=1,2,3,4,5,6,7,8 delims=," %a in (DhcpSrvLog-Mon.log,DhcpSrvLog-Tue.log,DhcpSrvLog-Wed.log,DhcpSrvLog-Thu.log,DhcpSrvLog-Fri.log,DhcpSrvLog-Sat.log,DhcpSrvLog-Sun.log) do if [%e] NEQ [] echo %b,%c,%d,%e,%f,%g >> text.csv
c:\tmp>echo Date,Time,Description,IP,Hostname,MAC >> text2.csv
c:\tmp>for /f "tokens=1,2,3,4,5,6 delims=," %a in (text.csv) do if "%c" EQU "Renew" echo %a,%b,%c,%d,%e,%f >> text2.csv
c:\tmp >"c:\Program Files (x86)\Log Parser 2.2\LogParser.exe" -i:csv -o:TPL -tpl:dhcp2.tpl "SELECT IP, hostname, mac, max(to_timestamp(add(add(Date, ' '),time), 'MM/dd/yy HH:mm:ss')) as timestamp, EXTRACT_TOKEN(ip, 0, '.') as octet1, EXTRACT_TOKEN(ip, 1, '.') as octet2, EXTRACT_TOKEN(ip, 2, '.') as octet3, EXTRACT_TOKEN(ip, 3, '.') as octet4, add(strrepeat('0',sub(3, to_int(strlen(octet4)))),octet4) as octet4lz, add(strrepeat('0',sub(3, to_int(strlen(octet3)))),octet3) as octet3lz INTO text2.html FROM text2.csv group by IP,mac,hostname order by octet1,octet2,octet3lz,octet4lz"
"c:\Program Files (x86)\Log Parser 2.2\LogParser.exe" -i:csv -o:CSV "SELECT IP, hostname, mac, max(to_timestamp(add(add(Date, ' '),time), 'MM/dd/yy HH:mm:ss')) as timestamp, EXTRACT_TOKEN(ip, 0, '.') as octet1, EXTRACT_TOKEN(ip, 1, '.') as octet2, EXTRACT_TOKEN(ip, 2, '.') as octet3, EXTRACT_TOKEN(ip, 3, '.') as octet4, add(strrepeat('0',sub(3, to_int(strlen(octet4)))),octet4) as octet4lz, add(strrepeat('0',sub(3, to_int(strlen(octet3)))),octet3) as octet3lz INTO b8.csv FROM text2.csv group by IP,mac,hostname order by octet1,octet2,octet3lz,octet4lz"
Source: https://habr.com/ru/post/161583/
All Articles