Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Creating a two column list of date pairs form a single column list Post 302843704 by jbrandt1979 on Wednesday 14th of August 2013 01:22:00 PM
Old 08-14-2013
Creating a two column list of date pairs form a single column list

Hi all, looking for some help here. I'm what you'd call a dirty programmer. my shell scripts might be ugly, but they (usually) function...

Say I have a single column text file with a list of dates (yyyymmdd) that represent the elevation of a point on that date (I work with land subsidence, so the elevation changes thru time):

Code:
date1
date2
date3
date4
...
date-n

I want to then create another two column text file that contains a list of all possible date combinations, so I can then figure out the change in elevation between two time periods. I need to create this text file for input into another software I use.

Code:
date1  date2
date1  date3
...
date1  date-n
date2  date3
date2  date4
...
date2  date-n
date3  date4
...
date-n-1 date-n

Any ideas?

Thanks all!
JB

Last edited by Scott; 08-14-2013 at 04:16 PM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sorting list of files per date column

Hi all, I have a pecular issue in sorting these files (not an ls -lrt) in Solaris environment. All the below files are modified on November 4th, but I want to sort these files as per date (eg: 01May07_1623 = ddmmmyy_hhmm) Nov 4 18:27 SONYELEC00.GI22973.01May07_1623.gpg Nov 4 18:27... (10 Replies)
Discussion started by: shivaastrogun
10 Replies

2. Shell Programming and Scripting

paste each 10 lines of single column to several column

Hi, I need to paste each 10 lines of single column to several columns. Please, can anyone tell me how to write in awk? Input File: 22 34 36 12 17 19 15 11 89 99 56 38 29 (4 Replies)
Discussion started by: nica
4 Replies

3. UNIX for Dummies Questions & Answers

creating a file using the fist column and printing second column

Hello all. I have a problem that I need help solving. I would like to convert the following file: human pool1_12 10e-02 45 67 human pool1_1899 10e-01 45 29 human pool1_1829 10e-01 43 26 horse pool1_343 10e-20 65 191 horse pool1_454 10e-09 44 43... (5 Replies)
Discussion started by: viralnerd
5 Replies

4. UNIX for Advanced & Expert Users

need to get single column form csv file

hi 2 all i need to get single column from one csv file anyone help me ! >cat file.csv name,age x,1 y,2 z,3 Use code tags please, ty. in this "file.csv" file i need only name column can u help me !:b::b: (7 Replies)
Discussion started by: ponmuthu
7 Replies

5. Shell Programming and Scripting

Construct 3 column table from one column list

Hi all! trying my best to parse a public site for information (ie fiscal year and turnover) about corporations. Doing this by having a file with business name and registration number (search key) the file bolag.txt currently looks like this Burgundy 556732-7217 AcademicSearch 556406-9879... (11 Replies)
Discussion started by: martindebruin
11 Replies

6. UNIX for Dummies Questions & Answers

Creating a column based list from a string list

I have a string containing fields separated by space Example set sr="Fred Ted Joe Peter Paul Jean Chris Tim Tex" and want to display it in a column format, for example to a maximum of a window of 100 characters And hopefully display some thing like Fred Ted Joe ... (3 Replies)
Discussion started by: kristinu
3 Replies

7. UNIX for Dummies Questions & Answers

List several files into one single column

frtgyh (2 Replies)
Discussion started by: lucasvs
2 Replies

8. Shell Programming and Scripting

Converting Single Column into Multiple rows, but with strings to specific tab column

Dear fellows, I need your help. I'm trying to write a script to convert a single column into multiple rows. But it need to recognize the beginning of the string and set it to its specific Column number. Each Line (loop) begins with digit (RANGE). At this moment it's kind of working, but it... (6 Replies)
Discussion started by: AK47
6 Replies

9. Shell Programming and Scripting

Bring values in the second column into single line (comma sep) for uniq value in the first column

I want to bring values in the second column into single line for uniq value in the first column. My input jvm01, Web 2.0 Feature Pack Library jvm01, IBM WebSphere JAX-RS jvm01, Custom01 Shared Library jvm02, Web 2.0 Feature Pack Library jvm02, IBM WebSphere JAX-RS jvm03, Web 2.0 Feature... (10 Replies)
Discussion started by: kchinnam
10 Replies

10. Shell Programming and Scripting

Get maximum per column from CSV file, based on date column

Hello everyone, I am using ksh on Solaris 10 and I'm gathering data in a CSV file that looks like this: 20170628-23:25:01,1,0,0,1,1,1,1,55,55,1 20170628-23:30:01,1,0,0,1,1,1,1,56,56,1 20170628-23:35:00,1,0,0,1,1,2,1,57,57,2 20170628-23:40:00,1,0,0,1,1,1,1,58,58,2... (6 Replies)
Discussion started by: ejianu
6 Replies
DATETIMEIMMUTABLE.DIFF(3)						 1						 DATETIMEIMMUTABLE.DIFF(3)

DateTime::diff - Returns the difference between two DateTime objects

       Object oriented style

SYNOPSIS
public DateInterval DateTime::diff (DateTimeInterface $datetime2, [bool $absolute = false]) DESCRIPTION
DateInterval DateTimeImmutable::diff (DateTimeInterface $datetime2, [bool $absolute = false]) DateInterval DateTimeInterface::diff (Date- TimeInterface $datetime2, [bool $absolute = false]) Procedural style DateInterval date_diff (DateTimeInterface $datetime1, DateTimeInterface $datetime2, [bool $absolute = false]) Returns the difference between two DateTimeInterface objects. PARAMETERS
o $datetime - The date to compare to. o $absolute - Should the interval be forced to be positive? RETURN VALUES
The DateInterval object representing the difference between the two dates or FALSE on failure. EXAMPLES
Example #1 DateTimeImmutable.diff(3) example Object oriented style <?php $datetime1 = new DateTime('2009-10-11'); $datetime2 = new DateTime('2009-10-13'); $interval = $datetime1->diff($datetime2); echo $interval->format('%R%a days'); ?> Procedural style <?php $datetime1 = date_create('2009-10-11'); $datetime2 = date_create('2009-10-13'); $interval = date_diff($datetime1, $datetime2); echo $interval->format('%R%a days'); ?> The above examples will output: +2 days Example #2 DateTime object comparison Note As of PHP 5.2.2, DateTime objects can be compared using comparison operators. <?php $date1 = new DateTime("now"); $date2 = new DateTime("tomorrow"); var_dump($date1 == $date2); var_dump($date1 < $date2); var_dump($date1 > $date2); ?> The above example will output: bool(false) bool(true) bool(false) SEE ALSO
DateInterval.format(3), DateTime.add(3), DateTime.sub(3). PHP Documentation Group DATETIMEIMMUTABLE.DIFF(3)
All times are GMT -4. The time now is 09:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy