[lug] Bash-ing an FTP log summary

Tony Dyson anorak at comcast.net
Tue Jun 27 20:24:56 MDT 2006


First thought is that "cut" & a "for i in `cat <tmp-file>`; do 
[etcetera]" might help you to get the numerical component into a 
variable for further manipulation.

Bill Thoen wrote:
> Hi folks,
> 
> I'm trying to write a bash script to summarize total daily FTP transfers
> (in terms of data transfered in and out) from my vsftp logs. So far, I've got a file
> that produces output like this each day:
> 
> o 123456
> o 32456
> i 1235
> o 123456
> ... etc. 
> 
> The 'o' is out and 'i' is in. The number is the amount transfered. What I
> want to do is summarize the transfers each day and add them to a running
> total in a file. Can I do this in a bash script? How?



More information about the LUG mailing list