Skip to main content

All Questions

Tagged with
-1 votes
2 answers
590 views

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 |...
robetus's user avatar
  • 113
1 vote
4 answers
917 views

Given a weekday name, week of a month, and a year, how to find the date

I can find the last Monday using date -d 'last-monday' +%F but given a weekday name, week of a month, and a year, how to find the date? e.g. given: Monday, Week 4, June, 2022 output: 2022-06-20 given: ...
surz's user avatar
  • 21
0 votes
0 answers
13 views

Issue in calculating elapsed time in millisecond date command not found [duplicate]

I have the following code trying to calculate how much time it takes in milliseconds to build a docker container. However I am facing syntax error and command not found issue, running bash script bash ...
user1566490's user avatar
0 votes
1 answer
268 views

Comparing dates of different formats and matching it from another file

I have two data files with date stamps in different formats (as text in the file contents).  I wish to compare the two dates and print the variable from one file to another according to date in a ...
meenakshisreejith's user avatar
0 votes
1 answer
234 views

Display time logged in by hour(s) and minute(s)

I am writing a script to display how long a user has been logged in. who | grep "$userid" | awk '{print $1,$3,$4}' | while read user time; do \echo $(($(($(date +%s) - $(date -d "$time" +%s)))/60)) ...
Derek's user avatar
  • 11
0 votes
2 answers
459 views

Bash Time Difference

I have a log file and I need to make some calculations between two jobs to find time difference. In my log file I am supposed to calculate time between the jobs incoming request and candidate list ...
3aska's user avatar
  • 109
-2 votes
1 answer
1k views

Insert today's date at the end of a text file - using bash

I have a text files that is generated through daily running bash script - I want to append a date field into that text file - how can I achieve it ? Name NUM_OF_USERS A------10 B------20 **date-...
manisjos's user avatar
  • 109
1 vote
1 answer
206 views

writing a script that finds incorrect files, and corrects them through stdout

I am currently using UNIX bash, and I want to write shell script that allows me to correct the date entry by using information in a file's pathname. Background: I previously had 200 files that were ...
Ardenksie's user avatar
-1 votes
1 answer
1k views

calendar different between 2 dates [duplicate]

Convert your days alive to use dialog command and a calendar for date of birth select and current date Hint: dialog --stdout --title "Today" --calendar "today" 0 0 0 0 0 | awk -F/ '{ print $2"/"$1"/...
Alaa Ismael Al's user avatar
1 vote
3 answers
4k views

Rename files but retain files original time stamp in name

I have a list of a few hundred files. They are currently as below: filename.New_20160901.dat filename.New_20160902.dat ... etc., all the way up to filename.New_<current date>.dat I have a ...
J.Lo's user avatar
  • 11
-1 votes
2 answers
6k views

Adding timestamp to TOP command output [closed]

I need to monitor CPU and memory utilization/user by date/timestamp(hourly). In below 'TOP' command I need to add date/timestamp field also, so that I can prepare hourly rpeort of CPU usage Can ...
chhaya vishwakarma's user avatar
1 vote
1 answer
135 views

Bash format returns zeroes for H M [closed]

I'm trying to understand this behaviour of date in bash script. When I call date by itself and when I format the date I get different outputs. date Wed Aug 31 22:12:25 EDT 2016 date --date="$NOW" +"%...
Fawix's user avatar
  • 789
4 votes
2 answers
8k views

Millisecond time in a shell script

How can someone print the entire time ie, for example 12:07:59:393(HH:MM:SS:milliseconds) in milliseconds. I found a lot of posts saying how to print Milliseconds along witht HHMMSS but I want to ...
RajuBhai's user avatar
  • 191
6 votes
3 answers
3k views

How to sleep until a given date & time?

I want to write a shell where given a date (day-hour-min) e.g. 10:00 AM Sun 2:30 PM Mon ... It sleeps until that exact date & time. I thought one way of doing it is, I could get the current date ...
user's user avatar
  • 61
3 votes
2 answers
12k views

Subtract two dates using Shell Scripting [duplicate]

How can I subtract two dates in epoch format using Shell Scripting. I want the output in Months, Days, Hours format. Also It should work even for more than 12 months ( as I came across few which were ...
ajain's user avatar
  • 51

15 30 50 per page