简体   繁体   中英

Bash How to format a date

I want to grep a file with the following date format:

Thu Apr 24

At the moment I only have date +"%d %m %Y" and that's returning 24 04 2014.

How do I format to get "Thu Apr 24"?

So I need the day month and date?

man date将建议date +"%a %b %d"

You can try

date +"%a %b %d"

where

   %a     locale's abbreviated weekday name (e.g., Sun)

   %b     locale's abbreviated month name (e.g., Jan)

   %d     day of month (e.g., 01)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM