• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

(Date +%b) need to change to previous month..

How do I get the script to change the (date +%b) this month to the previous month? I need this to grep some log files in linux. I do not know any perl, only just started learning some basic scriping.

  • 2
1 Solution
some linux support
  env TZ=GMT+744 date +%d
If your linux does not, the simplest way might be to to use perl with the Date::Manip module.
Let me know ..
perl -MDate::Manip -e 'print UnixDate("last month","%b");'
jukesAuthor Commented:
I appreciate it very much. Don't know any perl as I mentioned, so I need to install Date::Manip module to perl, if there isn't one and that's it?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now