date

Change the last modification time of subfolders to that of the oldest file inside

Change the last modification time of subfolders to that of the oldest file inside Hello I would like to know how to scan and change the last modified date of all subfolders based on the oldest file in each subfolder. Example of Ubuntu folder structure: home/incoming/media/Something.something.1234/ or /Soemthing Soemthing 1234/ Which means there are folders …

Total answers: 1

Is there a tool to test if a date-time is in a given range?

Is there a tool to test if a date-time is in a given range? I need to develop a script to test if "now" (e.g. the output of date) is in a given range. For now, this range is expected to be a list of days of month (e.g. 10,11,12,13,21,22,23). And I could code that …

Total answers: 1

Changing non-standard date timestamp format in CSV using awk/sed

Changing non-standard date timestamp format in CSV using awk/sed I have a csv with a few hundred thousand lines and I’m trying to change the date format in the second field. I should also add the second field is sometimes not populated at all. The deplorable input format is DayofWeek MonthofYear DayofMonth Hour:Minute:Second Timezone Year …

Total answers: 4

Update any date to the current date in a text file

Update any date to the current date in a text file I have a text file which contains several occurrences of dates. All the dates are written in the format Mon-DD-YYYY. I have to update all these dates in the current date keeping the format Mon-DD-YYYY. The scripting language is bash. One big problem is …

Total answers: 2

Synching time and date of two Ubuntu machines not connected to the internet

Synching time and date of two Ubuntu machines not connected to the internet I have two machines machine A with ip 192.168.0.2 machine B with assigned IP 192.168.0.3 They are both connected to a local network and I would like to set the date and time of machine A to match those of machine B. …

Total answers: 4

Output date into specific column using bash

Output date into specific column using bash I want to output the date into a csv column using a bash script ignoring the header. I have this but it only gives the day of the week abbreviated and not does not place it in a specific column: date | awk ‘{print $1}’ >> date.csv Here …

Total answers: 2

Unix: how to get number of days from a given date like 10Dec2022

Unix: how to get number of days from a given date like 10Dec2022 Team, Can someone help find code for below.. Unix: how to get a count of number of days from a given date like 10Dec2022 to today. Looking for Answer: 102 as of (22Mar2023) Asked By: RaviKumar || Source If you need to …

Total answers: 2

Where is timedatectl information stored?

Where is timedatectl information stored? I am working on an embedded system without RTC battery. The time is synchronized via NTP when internet connection is available (which does not always happen). When the device is shut down, the time is reset to a past value. Sometimes I notice that this "default" value has been updated …

Total answers: 1

How can I transform dates expressed with month names to numerical month designations?

How can I transform dates expressed with month names to numerical month designations? I use MacOS and I have variable date in format 3.Jan.2023, 12.Nov.2017, 9.Apr.2022, … I need to change in 03.01.2023, 12.11.2017, 09.04.2022, … Asked By: Kire || Source You can use awk to convert from one format to the other: awk -F. …

Total answers: 5

How to change the time zone string of date command?

How to change the time zone string of date command? I’m curious about how to change the abbreviation of time zone shown by date command. Let the time zone unchanged, but how to change CST below to UTC+8? clay@LAPTOP-3PP2093I:~$ date Thu Dec 1 23:05:28 CST 2022 Thank you! PS 1. OS is ubuntu 22.04 PP …

Total answers: 1

Can `cal` show other Gregorian adoptions?

Can `cal` show other Gregorian adoptions? On my host I can show the adoption of the Gregorian calendar as it occurred for Great Britain and its colonies in 1752: $ cal september 1752 September 1752 Su Mo Tu We Th Fr Sa 1 2 14 15 16 17 18 19 20 21 22 23 24 …

Total answers: 1

How can I obtain the time stamp from a file or directory in touch format?

How can I obtain the time stamp from a file or directory in touch format? According to many websites I found online the touch commands’ -t argument accepts the time stamp in the following format: [[CC]YY]MMDDhhmm[.ss] Here, CC: The first two digits of the year. YY: The last two digits of the year. MM: Month …

Total answers: 1

Is there a reserved word for datetime for the start of the day?

Is there a reserved word for datetime for the start of the day? man date won’t show me any reserved words but they have ‘now’ or ‘today’ etc. I wonder if there is any clear way to print start(00:00:00) of the day. Will date -u -d "$(date +’%F’)" suffice in any situation? Looks a little …

Total answers: 1

Script – Compare filename date with current date

Script – Compare filename date with current date I’m trying to compare a file with date in its name to the current datetime of the system: Filenames are with the following format: FileName.yyyymmdd.hhmm.file (e.g. File156tr.20220914.0958.txt) I have came up with the following script: #!/bin/bash FROM_FILE=$(ls -1 /some/directory/File156tr.*.*.txt | grep -Eo ‘[[:digit:]]{8}’) NOW=$(date +"%Y%m%d") DIFFERENCE=$((NOW – …

Total answers: 2

Precision of the date command and arithmetic

Precision of the date command and arithmetic I take a date at nanosecond precision: $ start=$(date ‘+%s.%N’) …then print it: $ echo ${start} 1662664850.030126174 So far so good. But look what I get when I printf with some arbitrarily huge precision: 1662664850.0301261739805340766906738281250000000000000000000000000 Q1. Did the date command actually populate the start variable with that much …

Total answers: 4

ls: bash: printf: `Y': invalid format character in VS Code, not in Terminal

ls: bash: printf: `Y': invalid format character in VS Code, not in Terminal I upgraded to Linux Mint 21 (based on Ubuntu 22), having number of small issues, one of which is in VS Code, not in Terminal (gnome-terminal), running ls alias: bash: printf: `Y’: invalid format character While I have defined these aliases: # …

Total answers: 1

Real Time clock regarding timestamp storage

Real Time clock regarding timestamp storage I gone through some of the datasheet regarding RTC like MCP79411X, but having confusion like where RTC stores timestamp in sram or eeprom, can anyone explain me the flow of the below fig suppose timestamp store in SRAM then I2C connected to EEPROM how does the timestamp sended to …

Total answers: 2