how to get the last word from file

David Bruzos david at bruzos.org
Tue Mar 29 14:46:16 EST 2005


This command will do it on my system:
cal | tr ' ' '\n' | tail -n 2

I have to put 2 as arg for tail, because my cal command prints a blank line at the end...

DB

On Tue, Mar 29, 2005 at 12:17:43PM -0700, Ned wrote:
> Hi list,
> I am using the cal command to get current month. What I need for my shell script is how many days are there in the current month, that is, the last listed date for that month is that very number.
> How can I get that number?
> cal | tail -1
> and then what?
> 
> Many thanks!
> Ned
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup




More information about the Speakup mailing list