This is probably the dumbest question you guys can get, but I'm trying, as a complete noob, to display the unix calendar for all the months without Saturday and Sunday showing. How can I remove those fields without having to type all the fields in individually such as:
cal -y | awk '{print $2, $3, $4....etc.
I would like to just list 2 trough 6, then 10 through 14, 18 through 22 like that.
Any ideas?
Thanks,
Trellot
this one destroys all the formatting:
cal -y | sed 's/ */ /g' | cut -d " " -f 2-6,9-13,16-20
sed 's/ */ /g'
convert multiple spaces into a single space
cut -d " " -f 2-6,9-13,16-20
show columns 2 to 6, 9 to 13, and 16 to 20
using awk, but even this doesn't preserve all the formatting:
cal -y | awk '{printf "%2s %2s %2s %2s %2s %2s %2s %2s %2s %2s %2s %2s %2s %2s %2s \n",$2, $3, $4, $5, $6, $9, $10, $11, $12, $13, $16, $17, $18, $19, $20}'
cal -y|cut -c4-17,21-23,27-40,44-46,50-63