The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-09-2005
whatisthis's Avatar
Registered User
 

Join Date: Aug 2004
Posts: 175
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!
Reply With Quote
Forum Sponsor
  #2  
Old 11-09-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
might be helpful to see a sample of your '$0'
Reply With Quote
  #3  
Old 11-09-2005
whatisthis's Avatar
Registered User
 

Join Date: Aug 2004
Posts: 175
It's
DD0300312310250588 CA8440300444 220



Reply With Quote
  #4  
Old 11-09-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
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.$$
Reply With Quote
  #5  
Old 11-09-2005
whatisthis's Avatar
Registered User
 

Join Date: Aug 2004
Posts: 175
AWk convertion

Thank you soooo much for your quick reply!!!!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0