How to output the date without a colon using bash command
up vote
0
down vote
favorite
I want to output the following:
command:
date +%T*
01:49:14
But how to display it without the colons.. any ideas? I'm using bash command.
bash date command
add a comment |
up vote
0
down vote
favorite
I want to output the following:
command:
date +%T*
01:49:14
But how to display it without the colons.. any ideas? I'm using bash command.
bash date command
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to output the following:
command:
date +%T*
01:49:14
But how to display it without the colons.. any ideas? I'm using bash command.
bash date command
I want to output the following:
command:
date +%T*
01:49:14
But how to display it without the colons.. any ideas? I'm using bash command.
bash date command
bash date command
edited Nov 20 at 7:09
RavinderSingh13
24.8k41437
24.8k41437
asked Nov 20 at 7:00
Warsiders23
132
132
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
When I do man date
I got:
%T time; same as %H:%M:%S
Then why don't we do which will give same output as %T
option in date
rather than using %T
with external or bash tools to get results in different forms:
date +"%H-%M-%S"
OR
date +"%H/%M/%S"
OR
date +%H%M%S ##Without any output delimiter
1
The dash and slash are not shell metacharacters, so they don't need to be quoted:date +%H-%M-%S
anddate +%H/%M/%S
would work fine. But actually, I'd usedate +"%H-%M-%S"
anddate +"%H/%M/%S"
, since they match the semantics (the quoted section being the format string).
– Gordon Davisson
Nov 20 at 7:48
@GordonDavisson, sure thanks for letting know I have done the changes now.
– RavinderSingh13
Nov 20 at 9:29
1
Thank you all for your help. Much appreciated. :)
– Warsiders23
Nov 21 at 0:08
add a comment |
up vote
-1
down vote
How about?
date +%T | sed -e "s/:/ /g"
IMHO, you need not to use external command to get it whendate
could do it by itself see this once too stackoverflow.com/a/53387878/5866580
– RavinderSingh13
Nov 20 at 7:13
1
ah, I see, it should be the better way (y)
– enpiti
Nov 20 at 7:21
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
When I do man date
I got:
%T time; same as %H:%M:%S
Then why don't we do which will give same output as %T
option in date
rather than using %T
with external or bash tools to get results in different forms:
date +"%H-%M-%S"
OR
date +"%H/%M/%S"
OR
date +%H%M%S ##Without any output delimiter
1
The dash and slash are not shell metacharacters, so they don't need to be quoted:date +%H-%M-%S
anddate +%H/%M/%S
would work fine. But actually, I'd usedate +"%H-%M-%S"
anddate +"%H/%M/%S"
, since they match the semantics (the quoted section being the format string).
– Gordon Davisson
Nov 20 at 7:48
@GordonDavisson, sure thanks for letting know I have done the changes now.
– RavinderSingh13
Nov 20 at 9:29
1
Thank you all for your help. Much appreciated. :)
– Warsiders23
Nov 21 at 0:08
add a comment |
up vote
4
down vote
accepted
When I do man date
I got:
%T time; same as %H:%M:%S
Then why don't we do which will give same output as %T
option in date
rather than using %T
with external or bash tools to get results in different forms:
date +"%H-%M-%S"
OR
date +"%H/%M/%S"
OR
date +%H%M%S ##Without any output delimiter
1
The dash and slash are not shell metacharacters, so they don't need to be quoted:date +%H-%M-%S
anddate +%H/%M/%S
would work fine. But actually, I'd usedate +"%H-%M-%S"
anddate +"%H/%M/%S"
, since they match the semantics (the quoted section being the format string).
– Gordon Davisson
Nov 20 at 7:48
@GordonDavisson, sure thanks for letting know I have done the changes now.
– RavinderSingh13
Nov 20 at 9:29
1
Thank you all for your help. Much appreciated. :)
– Warsiders23
Nov 21 at 0:08
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
When I do man date
I got:
%T time; same as %H:%M:%S
Then why don't we do which will give same output as %T
option in date
rather than using %T
with external or bash tools to get results in different forms:
date +"%H-%M-%S"
OR
date +"%H/%M/%S"
OR
date +%H%M%S ##Without any output delimiter
When I do man date
I got:
%T time; same as %H:%M:%S
Then why don't we do which will give same output as %T
option in date
rather than using %T
with external or bash tools to get results in different forms:
date +"%H-%M-%S"
OR
date +"%H/%M/%S"
OR
date +%H%M%S ##Without any output delimiter
edited Nov 20 at 9:57
answered Nov 20 at 7:07
RavinderSingh13
24.8k41437
24.8k41437
1
The dash and slash are not shell metacharacters, so they don't need to be quoted:date +%H-%M-%S
anddate +%H/%M/%S
would work fine. But actually, I'd usedate +"%H-%M-%S"
anddate +"%H/%M/%S"
, since they match the semantics (the quoted section being the format string).
– Gordon Davisson
Nov 20 at 7:48
@GordonDavisson, sure thanks for letting know I have done the changes now.
– RavinderSingh13
Nov 20 at 9:29
1
Thank you all for your help. Much appreciated. :)
– Warsiders23
Nov 21 at 0:08
add a comment |
1
The dash and slash are not shell metacharacters, so they don't need to be quoted:date +%H-%M-%S
anddate +%H/%M/%S
would work fine. But actually, I'd usedate +"%H-%M-%S"
anddate +"%H/%M/%S"
, since they match the semantics (the quoted section being the format string).
– Gordon Davisson
Nov 20 at 7:48
@GordonDavisson, sure thanks for letting know I have done the changes now.
– RavinderSingh13
Nov 20 at 9:29
1
Thank you all for your help. Much appreciated. :)
– Warsiders23
Nov 21 at 0:08
1
1
The dash and slash are not shell metacharacters, so they don't need to be quoted:
date +%H-%M-%S
and date +%H/%M/%S
would work fine. But actually, I'd use date +"%H-%M-%S"
and date +"%H/%M/%S"
, since they match the semantics (the quoted section being the format string).– Gordon Davisson
Nov 20 at 7:48
The dash and slash are not shell metacharacters, so they don't need to be quoted:
date +%H-%M-%S
and date +%H/%M/%S
would work fine. But actually, I'd use date +"%H-%M-%S"
and date +"%H/%M/%S"
, since they match the semantics (the quoted section being the format string).– Gordon Davisson
Nov 20 at 7:48
@GordonDavisson, sure thanks for letting know I have done the changes now.
– RavinderSingh13
Nov 20 at 9:29
@GordonDavisson, sure thanks for letting know I have done the changes now.
– RavinderSingh13
Nov 20 at 9:29
1
1
Thank you all for your help. Much appreciated. :)
– Warsiders23
Nov 21 at 0:08
Thank you all for your help. Much appreciated. :)
– Warsiders23
Nov 21 at 0:08
add a comment |
up vote
-1
down vote
How about?
date +%T | sed -e "s/:/ /g"
IMHO, you need not to use external command to get it whendate
could do it by itself see this once too stackoverflow.com/a/53387878/5866580
– RavinderSingh13
Nov 20 at 7:13
1
ah, I see, it should be the better way (y)
– enpiti
Nov 20 at 7:21
add a comment |
up vote
-1
down vote
How about?
date +%T | sed -e "s/:/ /g"
IMHO, you need not to use external command to get it whendate
could do it by itself see this once too stackoverflow.com/a/53387878/5866580
– RavinderSingh13
Nov 20 at 7:13
1
ah, I see, it should be the better way (y)
– enpiti
Nov 20 at 7:21
add a comment |
up vote
-1
down vote
up vote
-1
down vote
How about?
date +%T | sed -e "s/:/ /g"
How about?
date +%T | sed -e "s/:/ /g"
answered Nov 20 at 7:11
enpiti
12413
12413
IMHO, you need not to use external command to get it whendate
could do it by itself see this once too stackoverflow.com/a/53387878/5866580
– RavinderSingh13
Nov 20 at 7:13
1
ah, I see, it should be the better way (y)
– enpiti
Nov 20 at 7:21
add a comment |
IMHO, you need not to use external command to get it whendate
could do it by itself see this once too stackoverflow.com/a/53387878/5866580
– RavinderSingh13
Nov 20 at 7:13
1
ah, I see, it should be the better way (y)
– enpiti
Nov 20 at 7:21
IMHO, you need not to use external command to get it when
date
could do it by itself see this once too stackoverflow.com/a/53387878/5866580– RavinderSingh13
Nov 20 at 7:13
IMHO, you need not to use external command to get it when
date
could do it by itself see this once too stackoverflow.com/a/53387878/5866580– RavinderSingh13
Nov 20 at 7:13
1
1
ah, I see, it should be the better way (y)
– enpiti
Nov 20 at 7:21
ah, I see, it should be the better way (y)
– enpiti
Nov 20 at 7:21
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387787%2fhow-to-output-the-date-without-a-colon-using-bash-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown