AnotherAlan
Technical User
Hi all,
I'm trying to come up with an awk statement that will give me the first Monday in the month.
I've got this so far, but it fails when the Monday is the 1st of the month. And it's not very elegant.
cal | awk 'NF >=6 {print $2}' | head -2 | tail -1
My AWK skills are very poor and I'm trying to learn, but what I guess I need is a way of finding the first non-blank field of $2 after $2=="M".
All help appreciated.
Alan
I'm trying to come up with an awk statement that will give me the first Monday in the month.
I've got this so far, but it fails when the Monday is the 1st of the month. And it's not very elegant.
cal | awk 'NF >=6 {print $2}' | head -2 | tail -1
My AWK skills are very poor and I'm trying to learn, but what I guess I need is a way of finding the first non-blank field of $2 after $2=="M".
All help appreciated.
Alan