Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I'm polling by snmp a router but the data polled need a date concatenated for each value,
I'm doing this:snmpwalk -v 1 -c any 10.1.1.1 OID | awk 'BEGIN {OFS=","} {print $1,$2";"}'
and result is:
74,289;
this means
(IF-id,Value)and I need attach the date to the values like this:
74,289,19:35:49;
(IF-id,Value,Date)There is any way I could do this?
regards,
Xoir

If you want to add the same time (time of execution) for every line :
snmpwalk -v 1 -c any 10.1.1.1 OID | \
awk -v OFS="," -v TIME="`date +'%H:%M:%S'`" \
'{print $1,$2,TIME ";"}'
If you want to add the real time (time when the line is proceeded) for every line, you can do something like this :
snmpwalk -v 1 -c any 10.1.1.1 OID | \
awk -v OFS="," -v TIME="date +'%H:%M:%S'" \
'function Time( t) {
TIME | getline t
close(TIME)
return Time
}
{ print $1,$2,Time() ";" }'
Jean-Pierre.

Yep, the first options should be what I need, but the other is a cool stuff exercise
thanks Jean!
Xoir

![]() |
Unix script help
|
SCO compiling problem Ple...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |