How to format holiday file?

0105

To format a holiday file for use with the ncal command, follow these guidelines:

  1. File Format: Each line in the holiday file should represent a single holiday and should be structured as follows:

    Month Day Holiday Name
    • Month: The month number (1 for January, 2 for February, ..., 12 for December).
    • Day: The day of the month (1 to 31).
    • Holiday Name: A descriptive name for the holiday.
  2. Example: Here’s an example of how the contents of a holiday file might look:

    # Format: Month Day Holiday Name
    1 1 New Year's Day
    2 14 Valentine's Day
    7 4 Independence Day
    11 11 Veterans Day
    12 25 Christmas Day
  3. Comments: You can add comments in the file by starting a line with the # character. These lines will be ignored by ncal.

  4. Whitespace: Ensure that there is at least one space between the month, day, and holiday name. Extra spaces are allowed but should not affect the formatting.

  5. Save the File: After formatting the file, save it with a .txt extension or any name you prefer.

Once your holiday file is formatted correctly, you can use it with the ncal command by specifying the file with the -h option:

ncal -h ~/path/to/your/holidays.txt

This will display the calendar along with the holidays you defined.

0 Comments

no data
Be the first to share your comment!