Code:
Linux 2.6.14-1.1637_FC4 (localhost.localdomain) 01/14/2006
12:00:01 AM CPU %user %nice %system %iowait %idle
12:10:01 AM all 0.30 0.00 0.06 0.10 99.54
12:20:01 AM all 0.13 0.00 0.04 0.02 99.82
12:30:01 AM all 0.14 0.00 0.04 0.08 99.73
12:40:01 AM all 0.04 0.00 0.05 0.01 99.91
12:50:01 AM all 0.11 0.00 0.03 0.00 99.86
01:00:01 AM all 0.03 0.00 0.02 0.13 99.81
01:10:01 AM all 0.10 0.00 0.04 0.01 99.86
I have this sample sar data, and I would like to get the Date value into a variable, and also the other data.
To get the date value, I am doing something like this:
Code:
sar | head -n1 | awk {'print $4'}
To get the other values I am doing something like this:
sar | awk {'print "INSERT INTO stats (tme\,usr\,nice\,system\,iowait\,idle)""VALUES \n (\47" $1" "$2 "\47" "\,"$4"\,"$5"\,"$6"\,"$7"\,"$8" );" '}
Is there a way to get the Date value into my second awk statment?
I would like to include Date into the SQL query too...
TIA