back       next

tips

Week of Month

Here is a simple one liner to get the week of month via awk from a `cal` output:

$ cal | awk -v date="`date +%d`" '{ for( i=1; i <= NF ; i++ ) if ($i==date) { print FNR-2} }'

highlight grep search string

Default to highlighting search string when using grep by adding the below alias to ~/.bashrc file:

alias grep='grep --color=auto'

analog filesize limit

I had some trouble with analog monthly stats not showing up for the last week and figured out that analog refuses to parse huge log files. I had one sitting at 3GB without being rotated and analog would error out with:

/usr/bin/analog: Warning F: Failed to open logfile
  /var/log/httpd/access_log: ignoring it

After running gzip on the log file, analog was then able to produce the reports. I think I read somewhere that the limit may be 2GB but have not tested this.

Syndicate content