Sponsored Content
Top Forums Shell Programming and Scripting Transpose timestamp based on column values and calculate time difference Post 302715799 by asnandhakumar on Monday 15th of October 2012 11:07:57 PM
Old 10-16-2012
Hi Pravin,

Thanks much for your quick response. I'm receiving the following errors, when executing this code :
Code:
$ transpose.log | while read line
> do
> (dt2=$(echo $line | awk '{print $4" "$5}')
> dt1=$(echo $line | awk '{print $1" "$2}')
> echo -n $(echo $line | awk '{print $4,$5","$1,$2","$3","}')
> echo $(($(date -d"$dt2" '+%s') - $(date -d"$dt1" '+%s')))
> done
ksh: 0403-057 Syntax error: `done' is not expected.

Thanks,
NK

---------- Post updated at 11:07 PM ---------- Previous update was at 12:01 PM ----------

Hi Pravin, This is the error msg, I get for this code:

Can someone help get a clean output

Code:
$ cat transpose.log | while read line
> do
> dt2=$(echo $line | awk '{print $4" "$5}')
> dt1=$(echo $line | awk '{print $1" "$2}')
> echo -n $(echo $line | awk '{print $4,$5","$1,$2","$3","}')
> echo $(($(date -d"$dt2" '+%s') - $(date -d"$dt1" '+%s')))
> done
-n ,08/23/2012 12:36:09,JOB_5340,
date: Not a recognized flag: d
Usage: date [-u] [+"Field Descriptors"]
date: Not a recognized flag: d
Usage: date [-u] [+"Field Descriptors"]
ksh[6]:  - : 0403-053 Expression is not complete; more tokens expected.

Many Thanks,
NK
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to calculate this time difference

Hi, Please help me in calculating the time difference between below mentioned timestamps. a=07/17/2007 02:20:00 AM MST b=07/17/2007 02:07:46 AM MST Thanks (2 Replies)
Discussion started by: Prat007
2 Replies

2. Shell Programming and Scripting

How to calculate the time difference.

Hi All, I've written a script which reads all the systems backup information and saves it in a log file. ssh -l ora${sid} ${primaryhost} "tail -1 /oracle/$ORACLE_SID/sapbackup/back$ORACLE_SID.log" | awk '{print $3,$4,$5,$6}' >> ${RESULTFILE} The output comes as below: 2008-09-30 06.00.01... (2 Replies)
Discussion started by: suri.tyson
2 Replies

3. Shell Programming and Scripting

How to calculate time difference between start and end time of a process!

Hello All, I have a problem calculating the time difference between start and end timings...! the timings are given by 24hr format.. Start Date : 08/05/10 12:55 End Date : 08/09/10 06:50 above values are in mm/dd/yy hh:mm format. Now the thing is, 7th(08/07/10) and... (16 Replies)
Discussion started by: smarty86
16 Replies

4. Shell Programming and Scripting

Calculate difference between two successive values

Hi, I have a file containing timestamps (at micro-seconds granularity). It looks like the following: 06:49:42.383818 06:49:42.390190 06:49:42.392308 06:49:42.392712 06:49:42.393437 06:49:42.393960 06:49:42.402115 Now I need a sed/awk script to take the difference of two successive... (2 Replies)
Discussion started by: sajal.bhatia
2 Replies

5. Shell Programming and Scripting

Calculate age of a file | calculate time difference

Hello, I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes... I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes. To do... (10 Replies)
Discussion started by: worm
10 Replies

6. Shell Programming and Scripting

Transpose field names from column headers to values in one column

Hi All, I'm looking for a script which can transpose field names from column headers to values in one column. for example, the input is: IDa;IDb;IDc;PARAM1;PARAM2;PARAM3; a;b;c;p1val;p2val;p3val; d;e;f;p4val;p5val;p6val; g;h;i;p7val;p8val;p9val; into the output like this: ... (6 Replies)
Discussion started by: popesk
6 Replies

7. Shell Programming and Scripting

Based on the first & last timestamp of the file, need to calculate the time taken to complete

Below is the sample file: 287 DEBUG syndesis.pb.util.ITraceManager - syOID=ELntNetwork:1005Mon Oct 15 17:18:21 IST 2012 <ELClientManagerenEmsSession() > Setting Java Properties 287 DEBUG syndesis.pb.util.ITraceManager - syOID=ELntNetwork:1005Mon Oct 15 17:18:21 IST 2012... (1 Reply)
Discussion started by: ashok.kumar
1 Replies

8. Shell Programming and Scripting

Calculate difference in timestamps based on unique column value

Hi Friends, Require a quick help to write the difference between 2 timestamps based on a unique column value: Input file: 08/23/2012 12:36:09,JOB_5340,08/23/2012 12:36:14,JOB_5340 08/23/2012 12:36:22,JOB_5350,08/23/2012 12:36:26,JOB_5350 08/23/2012 13:08:51,JOB_5360,08/23/2012... (4 Replies)
Discussion started by: asnandhakumar
4 Replies

9. Shell Programming and Scripting

Calculate time difference

I have time in a file in HH:MM:SS format as it contents(its not the file creation time). i need this to be converted to epoch time or time since 1970. The time is written into that file by a script, which i cannot modify. Im using AIX machine $ cat abc.txt 10:29:34 (2 Replies)
Discussion started by: gpk_newbie
2 Replies

10. Shell Programming and Scripting

Transpose from row to column using timestamp in first column

Gents, Transpose from row to column, taking in consideration the first column, which contends the date. Input file 72918,111000009,111000009,111000009,111000009,111000009,111000009,111000009,111000009,111000009 72918,2356,2357,2358,2359,2360,2361,2362,2363,2364 72918,0,0,0,0,0,0,0,0,0... (12 Replies)
Discussion started by: jiam912
12 Replies
STPTRS(l)								 )								 STPTRS(l)

NAME
STPTRS - solve a triangular system of the form A * X = B or A**T * X = B, SYNOPSIS
SUBROUTINE STPTRS( UPLO, TRANS, DIAG, N, NRHS, AP, B, LDB, INFO ) CHARACTER DIAG, TRANS, UPLO INTEGER INFO, LDB, N, NRHS REAL AP( * ), B( LDB, * ) PURPOSE
STPTRS solves a triangular system of the form A * X = B or A**T * X = B, where A is a triangular matrix of order N stored in packed format, and B is an N-by-NRHS matrix. A check is made to verify that A is nonsingular. ARGUMENTS
UPLO (input) CHARACTER*1 = 'U': A is upper triangular; = 'L': A is lower triangular. TRANS (input) CHARACTER*1 Specifies the form of the system of equations: = 'N': A * X = B (No transpose) = 'T': A**T * X = B (Transpose) = 'C': A**H * X = B (Conjugate transpose = Transpose) DIAG (input) CHARACTER*1 = 'N': A is non-unit triangular; = 'U': A is unit triangular. N (input) INTEGER The order of the matrix A. N >= 0. NRHS (input) INTEGER The number of right hand sides, i.e., the number of columns of the matrix B. NRHS >= 0. AP (input) REAL array, dimension (N*(N+1)/2) The upper or lower triangular matrix A, packed columnwise in a linear array. The j-th column of A is stored in the array AP as follows: if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n. B (input/output) REAL array, dimension (LDB,NRHS) On entry, the right hand side matrix B. On exit, if INFO = 0, the solution matrix X. LDB (input) INTEGER The leading dimension of the array B. LDB >= max(1,N). INFO (output) INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value > 0: if INFO = i, the i-th diagonal element of A is zero, indicating that the matrix is singular and the solutions X have not been computed. LAPACK version 3.0 15 June 2000 STPTRS(l)
All times are GMT -4. The time now is 10:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy