Search Results

Search: Posts Made By: tigo17
11,742
Posted By rk4k
Combining awk printf and print strftime command
I have a lines like below, captured from rrdtool fetch command,

1395295200 2.0629986254e+06 7.4634784967e+05
1395297000 2.0198121616e+06 6.8658888903e+05
1395298800 1.8787141122e+06...
11,742
Posted By anbu23
awk...
awk '{printf("%s,%12.4f,%12.4f\n",strftime("%c",$1),$2,$3) } '
11,742
Posted By Don Cragun
Another way to do it is by changing: awk...
Another way to do it is by changing:
awk '{print strftime("%c",$1)","($2)","($3)}'to:
awk -v OFMT='%.4f' '{print strftime("%c",$1)","$2+0","$3+0}'
Note that I used %.4f rather than the %12.2f you...
11,742
Posted By rk4k
With this code : awk...
With this code :

awk '{printf("%s,%12.4f,%12.4f\n",strftime("%c",$1),$2,$3) } 'I̶ ̶h̶a̶v̶e̶ ̶s̶p̶a̶c̶e̶ ̶i̶n̶ ̶a̶t̶ ̶t̶h̶e̶ ̶t̶h̶i̶r̶d̶ ̶f̶i̶e̶l̶d̶,̶ ̶n̶o̶t̶ ̶a̶ ̶b̶i̶g̶ ̶p̶r̶o̶b̶l̶e̶m̶. Ummm I...
Showing results 1 to 4 of 4

 
All times are GMT -4. The time now is 05:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy