Reputation: 11
I have date formatted like below and I want to remove GMT+05:30 from the date using a shell script.
Tue Dec 4 17:30:51 GMT+05:30 2012
and output should be
Tue Dec 4 17:30:51 2012
I am new to shell script and still learning.
Upvotes: 1
Views: 6552
Reputation: 5083
Use sed
if you can't change the date
output:
... | sed 's/GMT+5:30 //g' | ...
But a better solution is to use date
formatting capabilities:
date +"%a %b %d %T %Y"
(for details, see man date
)
Upvotes: 3