![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to calculate the maximum value & min value | gobinath | Shell Programming and Scripting | 1 | 05-28-2008 09:01 PM |
| calculate 13 months ago | andrea_mussap | Shell Programming and Scripting | 3 | 11-16-2007 12:18 PM |
| how do I calculate percentage ? | the_learner | High Level Programming | 6 | 04-18-2007 01:40 PM |
| How To Calculate | krishna_sicsr | Shell Programming and Scripting | 1 | 03-28-2007 07:24 AM |
| How To Calculate Data | krishna_sicsr | Shell Programming and Scripting | 0 | 03-24-2007 11:35 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
How to calculate with awk
Hi,
I have below awk statement and I need to convert the second field ( substr($0,8,6))from minutes to hours with 2 decimail place. How can I achieve this? /usr/bin/awk '{print substr($0,23,4),substr($0,8,6)}' /tmp/MANAGER_LIST.$$ >> /tmp/NEWMANAGER_LIST.$$ Thanks for any help! |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
might be helpful to see a sample of your '$0'
|
|
#3
|
||||
|
||||
|
It's
DD0300312310250588 CA8440300444 220 |
|
#4
|
||||
|
||||
|
Code:
/usr/bin/nawk '{printf("%s%s%.2f\n", substr($0,23,4), OFS, substr($0,8,6) / 60)}' /tmp/MANAGER_LIST.$$ >> /tmp/NEWMANAGER_LIST.$$
|
|
#5
|
||||
|
||||
|
AWk convertion
Thank you soooo much for your quick reply!!!!
|
||||
| Google The UNIX and Linux Forums |