Re: lug-bg: sum and sort with bash
- Subject: Re: lug-bg: sum and sort with bash
- From: Georgi Genov <ggenov@xxxxxxxxxxx>
- Date: Thu, 21 Oct 2004 16:48:03 +0300
Georgi Genov wrote:
Ivailo Ivanov wrote:
Zdraveite,
Imam fail sas sledata struktura:
#!/bin/sh
source_ip_db="10.0.1.2 10.0.1.3 10.0.1.4 10.0.1.5 10.0.1.6"
for $source_ip in $source_ip_db; do
tmp_trafic_ip=`cat trafic.log | grep "$source_ip " | tr -s ' ' | awk
'{ print $3 }'`
trafic_db[$source_ip]=$(echo "${trafic_db[$source_ip]} +
$tmp_trafic_ip" | bc)
echo "$source_ip ${trafic_db[$source_ip]}"
done
exit 0
да се fixna дока е време :)
#!/bin/sh
source_ip_db="10.0.1.2 10.0.1.3 10.0.1.4 10.0.1.5 10.0.1.6"
for source_ip in $source_ip_db; do
tmp_trafic_ip=`cat trafic.log | grep "$source_ip " | tr -s ' ' | awk '{
print $3 }'`
trafic_db[$source_ip]=$(echo "${trafic_db[$source_ip]} + $tmp_trafic_ip"
| bc)
echo "$source_ip ${trafic_db[$source_ip]}"
done
exit 0
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================
|