Skip to main content

All Questions

Tagged with
2 votes
3 answers
463 views

Convert mm to hh:mm

I am using awk to get all of the 4th comma-delimited fields, which is a duration in minutes. The required output is in the format of hh:mm, so I need to convert that from minutes. "jone",&...
SRash's user avatar
  • 111
2 votes
5 answers
7k views

Converting date of format '%d/%m/%Y %H:%M' into seconds

I'm getting the following error date: invalid date '23/07/2021 14:44' when running this code start="23/07/2021 14:44" startSec=`date +%s -d "${start}"` I also tried start="...
lilek3's user avatar
  • 77
1 vote
2 answers
2k views

How to work with date command in a bash script through variable

I have a file with specific dates and i want to convert them to UTC format. so I prepared a small script I get below errors: date: option requires an argument -- 'd' Try `date --help' for more ...
Paul's user avatar
  • 35
2 votes
6 answers
153 views

Get list of folders that are after certain number

I have a folder which subfolder naming convention is like yyyymm for e.g. 200801, 200803 etc. I want to list down folder after 201412 via command line means to upload to S3. Is there a way to do it?
Moses Liao GZ's user avatar
0 votes
2 answers
3k views

Compare dates using awk in bash

I have a file and each line has some info and a date,so what I want is to print the lines with dates after a given date. I use this awk command sort -t$'|' -k5 $2 | awk -F '|' -v DatedAfter=$4 '!/^#/ ...
Μάριος Τσοκανάς's user avatar
1 vote
3 answers
1k views

How do I prepend a line read from STDIN with an epoch timestamp? [duplicate]

I'm wanting to prepend the epoch time to a single line of arguments. My desired output is: $ echo foo bar baz | some_bash_awk_sed_date_program_or_something_else 1491146539 foo bar baz The actual ...
mbigras's user avatar
  • 3,422
1 vote
1 answer
1k views

BASH AWK Script add days to fixed date

My task is to export data from a database with the UNLOAD TO statement in dbaccess and convert it into a file, that can be inserted into a similar database. Now the problem: The old database (let's ...
Mati's user avatar
  • 13
2 votes
3 answers
1k views

Truncating the precision of a date

I'm working with a bash script which polls build progress from several different systems. If a build is complete, it stats a log file to find out the last time it was edited, then feeds that time into ...
arthropodSeven's user avatar
1 vote
1 answer
230 views

How to accumulate data for the previous x number of days

Q: For the argument of the question, say today is 26/03/15. How can I 'accumulate' data for the last 5 days. But these dates are just an example. Ideally I would like to be able to accumulate data for ...
3kstc's user avatar
  • 4,976
7 votes
2 answers
4k views

Batch rename image files by age plus add date and variable to filename

The question is completely rewritten due to things learned from the first two answers and comments that I was unaware of when first asking. After a photo shoot I come home with files that look like ...
jshlke's user avatar
  • 177
2 votes
3 answers
1k views

Get the last minute dated lines from list

If I have an input file with a list of users and their dates they were last signed in, how can I select with a sort | awk function the last minute lines? The dates are written in a +%H:%M:%S format. ...
MEZesUBI's user avatar
  • 399