0

When I run date on my linux I get Sat Oct 31 11:53:22 BRST 2015. I want to get only Sat. How do I do that? So far I think I should use the code below but it does not work:

date | printf $1
5

date can output what you want without help of other commands:

$ date +%a
Sat

For more details: man 1 date

  • great answer :) The other answer was also perfect but yours is easier. – Samul Oct 31 '15 at 14:05
0

Try this:

date | cut -d' ' -f1

man 1 cut will give you explanation.

  • great answer man I didnt know "cut" but the answer of yeti is a little easier. Anyway thank you so much! – Samul Oct 31 '15 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.