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
Number of days between two distinct dates radheymohan UNIX for Advanced & Expert Users 1 10-16-2007 05:39 AM
Find number of days and list out the dates in between Raynon Shell Programming and Scripting 2 02-12-2007 05:52 PM
Getting week number of the month sbasetty Shell Programming and Scripting 21 11-06-2006 03:13 PM
month value in number aya_r Shell Programming and Scripting 1 08-22-2005 08:40 PM
Days of the month Anamika UNIX for Dummies Questions & Answers 6 10-20-2004 08:06 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-20-2006
Registered User
 

Join Date: Jun 2002
Location: PA
Posts: 17
Calc number of days in a month

Looking for some help on capturing the number of days in a month to set as a loop counter. Any ideas, please let me know.
Reply With Quote
Forum Sponsor
  #2  
Old 07-20-2006
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,638
Code:
cal | awk 'END{print $NF}'
Reply With Quote
  #3  
Old 07-20-2006
Registered User
 

Join Date: Jun 2002
Location: PA
Posts: 17
Thanks for the reply...

I understand the cal and awk but not clear on the 'END{print $NF}'

Are you setting the number of fields? ($NF)?
Reply With Quote
  #4  
Old 07-20-2006
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,638
No, I'm telling it to print the last field on the last line. The END block is execute after the entire file has been read, so the current line is the last line.
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 11:48 PM.


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