Hi, I am newbie in shell script.
I need your help to solve my problem.
Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file.
File1:
SourceFile,DateTimeOriginal
/home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07
/home/intannf/foto/IMG_0677.JPG,2015:02:17 10:47:23
/home/intannf/foto/IMG_0739.JPG,2015:02:17 11:32:21
/home/intannf/foto/IMG_0749.JPG,2015:02:17 11:37:28
/home/intannf/foto/IMG_0759.JPG,2015:02:17 11:49:09
/home/intannf/foto/IMG_0689.JPG,2015:02:17 10:57:05
/home/intannf/foto/IMG_0709.JPG,2015:02:17 11:13:31
/home/intannf/foto/IMG_0771.JPG,2015:02:17 11:51:22
/home/intannf/foto/IMG_0766.JPG,2015:02:17 11:50:08
/home/intannf/foto/IMG_0745.JPG,2015:02:17 11:36:01
File2:
2015/02/17,01:56:53,0.,-7.77075,110.35782,6.38
2015/02/17,10:47:23,0.,-7.77075,110.35782,6.34
2015/02/17,11:49:09,0.,-7.77075,110.35782,6.31
2015/02/17,11:49:53,0.,-7.77075,110.35782,6.25
2015/02/17,11:51:22,0.,-7.77075,110.35782,6.20
2015/02/17,11:53:25,0.,-7.77075,110.35782,6.19
2015/02/17,11:55:11,0.,-7.77075,110.35782,6.19
2015/02/17,11:56:35,0.,-7.77075,110.35782,6.80
Output required:
SourceFile,AirSpeed,GPSLatitude,GPSLongitude,Altitude
/home/intannf/foto/IMG_0677.JPG,0.,-7.77075,110.35782,6.34
/home/intannf/foto/IMG_0759.JPG,0.,-7.77075,110.35782,6.31
/home/intannf/foto/IMG_0771.JPG,0.,-7.77075,110.35782,6.20
Note:
The matched columns of both files are not written in the 'new' csv file i want to create.
In the file1, it has header file, while file2 doesn't have any header file. But, in the new csv file (output required), I want to create header file of each column.
and also, time and date of file1 is in same column (one column and separated by space), while time and date of file2 is in different different column (separated by comma).
Would you help me how to solve it? I am not sure how the shell script would be. But I am still learning. I really need your help. Sorry for my bad english, I hope you understand what I mean. Thank you.
Regards,
Intan