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 and shell scripting languages 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 09:39 AM
Find number of days and list out the dates in between Raynon Shell Programming and Scripting 2 02-12-2007 08:52 PM
Getting week number of the month sbasetty Shell Programming and Scripting 21 11-06-2006 06:13 PM
month value in number aya_r Shell Programming and Scripting 1 08-23-2005 12:40 AM
Days of the month Anamika UNIX for Dummies Questions & Answers 6 10-20-2004 12:06 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-20-2006
flounder flounder is offline
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.
  #2 (permalink)  
Old 07-20-2006
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,242

Code:
cal | awk 'END{print $NF}'

  #3 (permalink)  
Old 07-20-2006
flounder flounder is offline
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)?
  #4 (permalink)  
Old 07-20-2006
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,242
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:26 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0