Substract time between two columns


 
Thread Tools Search this Thread
Operating Systems Solaris Substract time between two columns
# 1  
Old 07-27-2010
Substract time between two columns

I've start and end time in two columns. How can I substract time from column 2 and column 1 and receive output in another file 'd' ?

Code:
$ cat c
12:55:04 2:03:56
2:03:56  3:20:17
14:00:00 13:05:00


Last edited by pludi; 07-27-2010 at 05:22 AM.. Reason: code tags, please...
# 2  
Old 07-27-2010
You may find what you need in the FAQ article: https://www.unix.com/answers-frequent...rithmetic.html

If that does not help, post what you have attempted so far, and I am sure someone will assist.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Substract 1 Month from MonthID

Hi, I am writing a small unix command to substract one month from the MonthID. If MonthID = 201301 the below script returns me 201212 if ] then a=`echo $monthid | cut -c1-4` b=`expr $a - 1` c=12 echo "$b$c" else a=`echo $monthid | cut -c5-6` b=`expr $a - 1` c=`echo $monthid | cut... (4 Replies)
Discussion started by: pinnacle
4 Replies

2. Shell Programming and Scripting

Need to substract date with current date and time

I have below file which contain the date in column 3,4,5 12345 open 10/10/13 10:08 PM 3 application is in java 67899 open 12/10/13 2:31 AM 2 apps can be reach 23456 open 11/9/13 2:31 AM 4 java is OK 65432 open 12/10/13 10:07 PM 9 we are... (1 Reply)
Discussion started by: vijay_rajni
1 Replies

3. Shell Programming and Scripting

Adding columns of time

Hello all, I'm in the process of writing a script, and I need to be able to add columns of time in the following format (time elapsed Net Backup logs): 000:01:03 000:00:58 000:00:49 Does anyone have a way of converting and/or adding timestamps such as these accurately? Thanks in... (9 Replies)
Discussion started by: LinuxRacr
9 Replies

4. Shell Programming and Scripting

Substract and print

Dear all, I need your help. I have file input like this: input.txt: R1031 50111G1 R1031 50121G1 R1031 50131G1 R1031 50141G1 R1031 50151G1 . . . . Desired output: 10315011 = G, 10315012 =... (2 Replies)
Discussion started by: attila
2 Replies

5. Ubuntu

How to get columns TIME and TTY of commands ps -A?

Hi, Commands ps -A include four parameters are PID, TTY, TIME and CMD. I can not found pathnames of TTY and TIME which I can read from file in C language to get information display on screen. Thank you! Ex: PID TTY TIME CMD 1 ? 00:00:01 init (2 Replies)
Discussion started by: newbie_member
2 Replies

6. Shell Programming and Scripting

substract variable from each line in a file

Hi everyone, I have a file containing one column and I want to subtract the first value (value of first line) from each line's value. 79304 99299 119294 139289 159284 179279 199274 219269 239264 259259 279254 299249 319244 339239 359234I tried working on an awk solution with... (1 Reply)
Discussion started by: ink_LE
1 Replies

7. AIX

Substracting time between two columns

I've start and end time in two columns. How can I substract time from column 2 and column 1 and receive output in another file 'd' ? Code: $ cat c 12:55:04 2:03:56 2:03:56 3:20:17 14:00:00 13:05:00 (1 Reply)
Discussion started by: alps0206
1 Replies

8. Shell Programming and Scripting

substract column based on some criteria

Please guide if you know how to solve this. I have a tab delimited INPUT FILE where each record is separated by ----- ----- ABC 4935402 4936680 Pattern=Cheers07080.1 ABC 4932216 4932368 Pattern=Cheers07080.1 ABC 4931932 4932122 ... (8 Replies)
Discussion started by: sam_2921
8 Replies

9. UNIX for Dummies Questions & Answers

Substract a certain number to the names of several files

We have a list of files (raw and jpeg types) with 2 different extensions (rw2 and jpg). When there is both the raw and jpeg files, their file numbers must be the same (215 and 215, 218 and 218). Sometimes there is only the jpeg file (216,217). bla_215.rw2 bla_215.jpg bla_216.jpg bla_217.jpg... (9 Replies)
Discussion started by: Epictete
9 Replies

10. Shell Programming and Scripting

Substract date (month) Problem

#!/bin/ksh month=`date | cut -c5-8` year=`date | cut -c24-28` echo "$month" echo "$year" --- This gives me output as Feb and 2009 but now I want to substract the 1 month from the current script and want output as Jan 2009. Please note I have searched a lot on forum and found... (5 Replies)
Discussion started by: niceboykunal123
5 Replies
Login or Register to Ask a Question