LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-14-2017, 11:55 PM   #1
vivekn1980
LQ Newbie
 
Registered: Nov 2017
Posts: 9

Rep: Reputation: Disabled
Calculate time difference between two lines


i grep time stamp in a file as given below

now i need to calculate time difference

file data:

18:29:10
22:15:50

please help
 
Old 12-15-2017, 12:30 AM   #2
!!!
Member
 
Registered: Jan 2017
Posts: 666

Rep: Reputation: 288Reputation: 288Reputation: 288
Another cool question!!! I'm a GooAddict; this: linux calculate time difference
finds tons, like this: https://www.linuxquestions.org/quest...ion-4175459414

Forum replys will never beat the speed of DDGoo!!!

There's also some, if you click on "Similar posts" (when you post new Thread), and at bottom of pages!!!

Last edited by !!!; 12-15-2017 at 12:33 AM.
 
Old 05-02-2018, 08:02 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Slackware 14.2 / Slackware 14.2 current / Manjaro
Posts: 6,440

Rep: Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287
Code:
  22:15:50
- 18:29:10
------------
equals answer
 
Old 05-02-2018, 08:06 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 16,848

Rep: Reputation: 2512Reputation: 2512Reputation: 2512Reputation: 2512Reputation: 2512Reputation: 2512Reputation: 2512Reputation: 2512Reputation: 2512Reputation: 2512Reputation: 2512
OP has history of asking same question(s) over and over.
 
Old 05-05-2018, 08:43 AM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Summer Midwest USA, Central Illinois, Winter Central Florida
Distribution: SlackwareŽ
Posts: 13,144
Blog Entries: 28

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Moderator response

@vivekn1980

I suggest that you look at https://www.linuxquestions.org/quest...#faq_lqwelcome

So you can post a good informational request and hopefully realize that LQ does expect you to follow such guidelines along with LQ Rules when posting.

Your posting history has shown mostly needs without deeds!
Quote:
Now that we are all aware of your 'needs'. What are your 'deeds'?
So please put some effort into posts too show us that indeed you have done some effort to find a solution. LQ has a good Search too allow you too possibly find a solution to your query that may lead to a solution for your query. Or do a DuckDuckGo for a potential answer or links to additional information.
 
Old 05-05-2018, 08:53 AM   #6
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Ubuntu, Devuan, OpenBSD
Posts: 3,272
Blog Entries: 3

Rep: Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445
Grab CPAN's Date::Calc module for Perl 5 and you'll be done in a few lines. The function to import would be either Delta_YMDHMS() or more probably Delta_DHMS() for your task.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate time difference without 'date -d` in Solaris boby.kumar Linux - Newbie 11 08-03-2017 12:38 AM
[SOLVED] How to Calculate Time Difference? santosh0782 Linux - Newbie 9 02-22-2014 08:57 PM
How to get Kernel space time and compare to userspace to calculate difference? sindhu4sind Programming 1 06-05-2012 12:09 PM
how to calculate time difference in milliseconds in C/C++ waqasdaar Programming 19 03-17-2009 04:02 PM
calculate time difference between 2 formatted timestamps nickleus Linux - General 3 05-12-2006 10:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration