Mountain bike training plans. Mountain bike coaching.

Start Training

Re: How to merge two .csv files as one workout?

Home MTB Training and Racing Forums Athlete Support Forum How to merge two .csv files as one workout? Re: How to merge two .csv files as one workout?

#7583
DaveDave
Keymaster

If you are familiar with (and not terrified of) the terminal, try this. 

Combining csv files can be done with the 'cat' utility in terminal. The 'cat' (for concatenate) command combines files, and this will work fine in your situation with a few changes beforehand. It goes like this:

1. Make a temporary directory, I'll call it temp. Place a copy of your workout files in this directory. Since we will make changes this is very important!

2. csv files are simple text files where the first row contains data headers and all other rows contain a data point. You only want the headers from the first file, so open the 2nd workout file in your favorite text editor (TextEdit.app is good) and delete the header row (I'm not familiar with the LeMond file format, there may be more than one row to delete).

3. Open the first workout file in a text editor. Go to the end of the file, and make sure the cursor (in TextEdit.app) will drop below the last line of text using the down arrow key. If it won't, hit the enter key once and save the file. If there is no end of line character after the last line in the first file the last entry of the first file gets combined with the first line of the 2nd file…this may or may not be necessary, and once you figure it out it will be the same every time.

4. Open terminal. cd to your temp directory with the edited workout files. Type 

cat w1.csv w2.csv >merged.csv

where w1 is the first workout and w2 is the 2nd workout. If all went well merged.csv (in the temp directory) will be the file you need.