Skip to main content

How to out the output of the command 'cal' to csv.? [Resolved]

How can I format the output of the command cal -y 2020 as a csv? I want to prepare the calendar in a table processor. Can this be done?

I am using Slackware 14.2.

Question Credit: dymdin
Question Reference
Asked September 14, 2019
Posted Under: Unix Linux
2 Answers

Try this,

 cal 2020  | sed 's/ \([0-9]\) /\1 /g;s/ \([0-9]\)$/\1/g;s/ /,/g;s/,,,/,/g' > 2020.csv

credit: msp9011
Answered September 14, 2019
Your Answer