Combining values from different files into one CSV file

Question!

I have a couple of files containing a value in each line

EDIT:
Oops... I figured out the answer to this question while in the midst of writing the post and didn't realize I had posted it by mistake in its incomplete state.

I was trying to do:

paste -d ',' file1 file2 file 3 file 4 > file5.csv

and was getting a weird output. I later realized that was happening because some files had both a carriage return and a newline character at the end of the line while others had only the newline character. Gotta always remember to pay attention to those things =P

By : grosauro


Answers

file 1:

1
2
3

file2:

2
4
6
paste --delimiters=\; file1 file2

Will yield:

1;2
3;4
5;6


The previous answers using logparser or the commandline tools should work. If you want to do some more complicated operations to the records like filtering or joins, you could consider using an ETL Tool (Pentaho, Mapforce and Talend come to mind). These tools generally give you a graphical palette to define the relationships between data sources and any operations you want to perform on the rows.



Also don't forget about the ever versatile LogParser if you're on Windows.

It can run SQL-like queries against flat text files to perform all sorts of merge operations.



This video can help you solving your question :)
By: admin