LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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: 14

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
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
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: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
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
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
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



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 02:08 PM.

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
Open Source Consulting | Domain Registration