Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading two data files and re-arrange into one data file

Status
Not open for further replies.

maolivar

Technical User
Apr 1, 2008
6
FR

Hello,

I am trying to read 2 files and writing to the 3rd file if i find the same elements in 2 files.

my first file is:
11/05/2010-18:09:55 2158
11/05/2010-18:09:56 1582
11/05/2010-18:09:57 1315
11/05/2010-18:09:58 400
11/05/2010-18:09:59 894
11/05/2010-18:10:00 1225
11/05/2010-18:10:01 1296
11/05/2010-18:10:02 1283
11/05/2010-18:10:03 944

my second file is:
11/05/2010-18:09:57 1084
11/05/2010-18:10:00 2751
11/05/2010-18:10:01 2218
11/05/2010-18:10:02 1244
11/05/2010-18:10:03 2095
11/05/2010-18:10:04 2522
11/05/2010-18:10:05 2172
11/05/2010-18:10:06 2051
11/05/2010-18:10:07 1476

if $1 of my first file is equal to $1 of my 2nd file,i would like to print $1 and $from first file and $2 from 2nd file.
if $1 of my first file is different to $1 of my 2nd file, print $1 and $2 from both files.

like this
11/05/2010-18:09:55 2158
11/05/2010-18:09:56 1582
11/05/2010-18:10:00 1225 2751
11/05/2010-18:10:01 1296 2218
11/05/2010-18:10:02 1283 1244

Thanks in advance and best regards

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top