2 added 132 characters in body
source | link

Generate the weeks sequence with ncal and use paste for having both outputs side by side.

$ paste <(echo; echo; ncal -w | tail -1 | xargs -n1 printf '%2d\n') <(cal)

If you don't like having tabs as delimiters just add something like sed 's/\t/ /'


Edit: way simpler, no need to care about tabs:

$ paste -d' ' <((echo -n '   '; ncal -w | tail -1 )| fold -w 3) <(cal)

Generate the weeks sequence with ncal and use paste for having both outputs side by side.

$ paste <(echo; echo; ncal -w | tail -1 | xargs -n1 printf '%2d\n') <(cal)

If you don't like having tabs as delimiters just add something like sed 's/\t/ /'

Generate the weeks sequence with ncal and use paste for having both outputs side by side.

$ paste <(echo; echo; ncal -w | tail -1 | xargs -n1 printf '%2d\n') <(cal)

If you don't like having tabs as delimiters just add something like sed 's/\t/ /'


Edit: way simpler, no need to care about tabs:

$ paste -d' ' <((echo -n '   '; ncal -w | tail -1 )| fold -w 3) <(cal)
1
source | link

Generate the weeks sequence with ncal and use paste for having both outputs side by side.

$ paste <(echo; echo; ncal -w | tail -1 | xargs -n1 printf '%2d\n') <(cal)

If you don't like having tabs as delimiters just add something like sed 's/\t/ /'