New answers tagged

3

Drop the unnecessary time part The time part of the date doesn't play a role in the filtering. You could drop it and the script will be simpler. Use more variables I find this line a bit difficult to read for multiple reasons: '{ $2 = substr($2,8,4)sprintf("%02d",(match("JanFebMarAprMayJunJulAugSepOctNovDec",substr($2,4,3))+2)/3)substr($2,1,2)"T"substr($...


4

Here's a refactoring which condenses much of the logic after the zgrep into a single Awk script. Prefer modern $(command substitution) over obsolescent `command substitution`syntax. But the date command substitutions don't really make sense here. Just pass in the dates as literal strings, like dstart="20190109T00:00:00". Two Awk processes can often be ...


7

I assume there's a simply copy-paste error where you have | at the start of a line, instead of at the end of the preceding line? If we're just going to count lines, there's no need for sort | uniq -c | sort -n - we can replace all that with sort -u. These two Awk programs can be trivially combined: awk '$0 !~ /127\.0\.0\.1|bot\.|bot\/|dotbot|crawler/' | ...


Top 50 recent answers are included