Number of days in current month using awk

Awk and gawk scripting forum.

Number of days in current month using awk

Postby james on January 22nd, 2008, 11:50 pm

This one liner finds the number of days in the current month. It calls "cal", then just pulls out the final day.
Code: Select all
cal | awk 'NF>0{q=$NF}END{print q}'
james
Member
 
Posts: 18
Joined: January 18th, 2008, 2:27 pm

Return to Awk

Who is online

Users browsing this forum: No registered users and 0 guests

cron

dsplabs homelinux bloglinux forums new! travel photographyawklores new! cryptographyjames' home
©2009 dsplabs.com.au