If you need to get some text which is in file between two lines you could use awk for this. You may need it while analyzing access logs to fix some issue, for instance. Here’s how you could do it: awk ‘/2012:00:20:49/, /2012:00:35/’ access_log > output It’s a simple and convenient way.
If you need quick and simple way to get squid users traffic usage you can use this script: Here is an example: [root@server ~]# head -n 50000 /var/log/squid/access.log | /usr/local/bin/traf.sh alice – size: 1532.08 Mb linda – size: 11.84 Mb cray – size: 9.30 Mb focus – size: 3.05 Mb santa – size: 0.96 Mb…
If you need to get value of last column in awk you can use built-in variable NF which means the number of fields in record. Or next, if you need next to the last field. And so on.