Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cal]

cal is a command line application which displays an ASCII calendar along with the current date.

0
votes
2answers
68 views

Pick off 'first' dates using cal function in bash

I'm trying to pick off the first Monday, second Tuesday, second Saturday, etc. out of the cal function and piping awk commands. For this month, I can get the first Tuesday correctly with the command ...
-5
votes
2answers
259 views

One liner required to get last working day for previous month [closed]

E.g. today is 06/04/2018; the desired output is 05/31/2018. For 07/01/2018 the output should be 06/29/2018.
-1
votes
4answers
97 views

How can get the list of all Saturdays in a given date range ex: 20170101 to 20170630 in YYYYMMDD format in linux?

I need to get the list of all Saturdays in a given date range ex: 20170101 to 20170630 in YYYYMMDD format in linux
5
votes
2answers
96 views

Is it possible to allow a background process to continuously output to terminal?

Here's a use-case to clarify my question. Say I have a calendar program that is set to run in ~/.bashrc, and it ensures the streaming output overwrites the same block of lines. Is it possible to have ...
6
votes
4answers
1k views

Output current day using cal

I'm asked to output the current day using the cal command. So far, I discovered that before the current date there is a _ symbol. I decided to use grep here: cal | grep '\b_*', but it outputs the ...
-2
votes
2answers
312 views

Calendar to Cal displaying schedule [closed]

I don't understand how to create a txt to use the calendar utility to display "notes"
0
votes
1answer
56 views

Why is that `ncal -CM` doesn't work but `ncal -MC` does?

I wanted to put a calendar in a file so I ran: $ ncal -CMh > file.txt But instead I received the following: Usage: cal [general options] [-hjy] [[month] year] cal [general options] [-hj] [...
3
votes
2answers
360 views

Why does 'cal' use weird 08 / ^H / \b terminal code for highlighting and how does that work?

When you run cal on Linux, the output for the current month will reverse video highlight the current day. When I send that output to hexdump -c, I get some interesting results: 0000000 ...
0
votes
2answers
456 views

How to display each day of a month on a separate line using tr, sed and cal

How to use commands, cal, sed and tr and the pipe to display the numerical days (e.g., 1, 2, 3, etc.) of a month, with each day on a separate line I've tried: cal 12 2015| sed '3,7p' | tr -cs "[:...
2
votes
1answer
115 views

Zeller's congruence and cal command

According to Zeller's Congruence, the day of 29 Feb, 1600 is Tuesday. However, the cal command shows it as Friday.Is there a bug in cal's code or a limit on the range of years which Zeller's ...
4
votes
2answers
789 views

How can I make the `cal` tool in OSX highlight the current day?

In Ubuntu and Fedora, when I type cal on the command line I get an ASCII calendar with the current day highlighted. In OSX, when I type cal, I get an ASCII calendar but no day is highlighted. How ...
0
votes
3answers
2k views

How to Print the calendar for March and April 2015 and show the calendar entries side-by-side? using UNIX

how to Print the calendar for March and April 2015 and show the calendar entries side-by-side? in UNIX
4
votes
2answers
2k views

Multi-month view in calendar (cal) in OS X

I am hoping to run some of the commands listed in this article, e.g.: cal -3 which is supposed to show me the last month, this month, and next month. This command does not work in OS X. $ cal -3 ...
2
votes
1answer
337 views

calendar to check the date and then search 3 months back and add up the days of those months

I want to use the cal command or the date command to display the current day, then I want it to display 3 months before the current date, then add up all the days in those 3 months up to the current ...
5
votes
1answer
2k views

How to emphasize holidays by color in `cal` command

I want to emphasize holidays by color in cal or similar command. I'm using OS X and Ubuntu 14, is there easy way to enable the function?
3
votes
3answers
2k views

bash script that reads user input and uses “cal” command to validate dates

I want to write a script that reads my input (for example if my script is called "check", then I would type "check 9 4 1993" and that input would go through the cal command and will check through the ...
0
votes
1answer
143 views

how to write this if command?

my script name is 1. when i type in "1 2012 12 12". it shows current date calendar and when i enter a invaild date like "1 2323232" cal gives me a error so how could i put that in if loop that if it ...
3
votes
2answers
614 views

Highlight today in Mac's cal

Every Mac comes with cal which shows a simple calendar of current month. Output is something like this: February 2014 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 ...
1
vote
1answer
396 views

Julian calendar for a UK locale in ncal

On my machine, ncal identifies my country code as GB, and use that to find the date for the shift to the gregorian calendar, and I think cal uses the same date by default: cal: $ cal 09 1752 ...
3
votes
2answers
1k views

How to make FreeBSD variant of cal start weeks on mondays?

Can week start day be changed in cal output? Is it hardcoded? Notice: not the ncal.
3
votes
1answer
271 views

Cal no space delimiter

I am an OpenBSD user and I am writing an awk script which automatically generates TeX course calendars for all courses that I teach. To obtain actual calendar out of the system I use Unix cal command. ...
27
votes
2answers
21k views

Is `cal` broken? What happened in September 1752?

If you look at the output of cal 9 1752 you will see this strange output: September 1752 S M Tu W Th F S 1 2 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 The following story ...
6
votes
6answers
5k views

Highlight the current date in cal

I would like to highlight today's date in the output of the cal command. What is the best way? This is what I have so far: cal -m | grep -C6 --color "$(date +%e)" but it doesn't work for all cases ...