Tag Info

New answers tagged

1

You need to write in BIOS, Suppose you want to change date strings to the following string: root@debian:/home/mohsen# date -s "Sat May 23 18:56:59 IRDT 2015" root@debian:/home/mohsen# hwclock -w An first line you set a date, But you need to write in bios, In second line with hwclock -w you write your time in bios.


3

In a recent question I asked what's the best practice for this kind of change. There was no answer yet. However, I can give you the recipe I am using, which has proven to work fine. All the programs pick the date up correctly. My description is for Ubuntu, but will likely work on Debian and Mint. Preparations Copy the locale you want to customize from ...


0

The tool you need is called jhead. Some OSs release it via their package managers, but this is the home of jhead, and you can download the latest version from there. From the jhead manual: -ta Adjust time stored in the Exif header by h:mm forwards or backwards. Useful when having taken pictures with the wrong time set on the camera, such as after ...


2

One of your problems is that you left out the double quotes around the command substitution, so the output from the date command was split at spaces. See Why does my shell script choke on whitespace or other special characters? This is a valid command: cp -a /home/bpacheco/Test1 "/home/bpacheco/Test2-$(date +"%m-%d-%y-%r")" If you want to append to the ...


0

If you can guarantee that the input is formatted exactly as you have shown, you can do it entirely in sed.  It's a little brute force-ish: sed \ -e 's/"timestamp":"... Jan/"timestamp":"01/' \ -e 's/"timestamp":"... Feb/"timestamp":"02/' \ -e 's/"timestamp":"... Mar/"timestamp":"03/' \ -e 's/"timestamp":"... ...


1

jq, node: cat /tmp/what \ | jq '.timestamp' \ | while read line ; do \ node -e "console.log(new Date($line).toISOString())" ;\ done Could also use a single Node.js program to process the whole file for performance, but that might be getting too far into JS-land. (Ping if you want details.)


3

It would be possible to use sed for this but awk is more natural: awk -F'"' -v OFS='"' '$8 {cmd="date -d \""$8"\" +%FT%T%z"; cmd | getline $8; close(cmd)} 1' input.json {"_id":"","timestamp":"2015-04-20T01:30:55-0700"} {"_id":"","timestamp":"2015-04-20T01:32:25-0700"} {"_id":"","timestamp":"2015-04-20T01:35:39-0700"} The above show an offset of -7:00 ...


2

If you have GNU date, you can do: date -d yesterday +%Y%m%d For example: $ date -d yesterday +%Y%m%d 20150430 $ date +%Y%m%d 20150501 The command would be: /usr/bin/wget --output-document=/file.csv "http://domain.com/export/file.csv?DateRange=`date -d yesterday +%Y%m%d`,`date +%Y%m%d`" Check the GNU documentation for more examples. You can ...


1

okay - figured it out. Posting back just incase if someone runs into it someday at sometime. The % sign has a special meaning in crontab. it's changed to newline and any string after the first % will be sent to the command as standard input. To force cron to interpret it literally, you have to escape it: 00 18 * * * rsync -a -v --delete -e ssh ...


1

If you have systemtap installed, which is likely the case on a CentOS system, it's easy to trace any system call system-wide. # cat clock.stp probe nd_syscall.stime, nd_syscall.settimeofday, nd_syscall.clock_settime { printf("process %d (%s) called %s(%s) at %d\n", pid(), execname(), name, argstr, gettimeofday_us()); } # stap clock.stp To ...


4

For this answer, I'll assume that there may be several elements working hard to set your time straight. Since I don't really want to wild-guess about which one is working against you, I'll try and give you an answer which should help you find it yourself instead. On a UNIX system, the clock can typically be set using the stime system call. As things ...


3

The original touch command only supported setting the file's modification time to the current time. Historical System V systems introduced the ability to specify a time as the first argument, with the syntax [YY]MMDDhhmm (optional year, month, day, hours, minutes). At that time, the convention to use a dash and a letter followed by a value for optional ...


2

According to this hp man page for touch: http://h20565.www2.hp.com/hpsc/doc/public/display?docId=emr_na-c02273390 ... the command expects the following form for touch: touch time_str file_name That form is recognized when neither the -r option, the -t option, nor the -- option delimiter is specified, and the first operand consists of all decimal digits.



Top 50 recent answers are included