Results 1 to 5 of 5
hi, bit of a noob question here, but in the absence of any disk-level resilience, i'm trying to dump a database to file every hour. i want to rotate the ...
- 09-18-2007 #1Just Joined!
- Join Date
- Sep 2007
- Posts
- 2
extracting 24hr time from date(): grep or sed?
hi, bit of a noob question here, but in the absence of any disk-level resilience, i'm trying to dump a database to file every hour. i want to rotate the files by extracting the 24 hour time from date() and embedding it in the file name.
i've tried the following to extract, but have a feeling i'm somewhat misguided here
:
...grateful for any thoughts or suggestions.Code:TIMESTAMP=$(date) sed $TIMESTAMP s'/^*\d\d:\d\d.*/g'
- 09-18-2007 #2Just Joined!
- Join Date
- Aug 2007
- Posts
- 37
Couldn't you just use date's built-in formatting?
Code:TIMESTAMP=$(date +"%R")
- 09-18-2007 #3Just Joined!
- Join Date
- Sep 2007
- Posts
- 2
...er, yep.
right under the proverbial.

thanks for the steer
- 01-17-2012 #4Just Joined!
- Join Date
- Jan 2012
- Posts
- 1
24hr parsing
Newbie to this site. I'm curious what your final script was to parse date 24hrs?
thanks.
- 01-18-2012 #5forum.guy
- Join Date
- May 2004
- Location
- arch linux
- Posts
- 18,096
Hello and welcome, tobius74!

This thread is well over 4 years old so I'm going to lock it but please feel free to start a fresh thread if you need any help with Linux.
Thanks!oz
→ new members/users: read this first | new member faq
→ no private messages requesting computer support - post them on the forums!
→ please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.


