LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-27-2010, 07:14 AM   #1
Swizzgard
LQ Newbie
 
Registered: Nov 2010
Posts: 2

Rep: Reputation: 0
Merge .csv files


Hello,

First of all, apologies for the newbness of this question.

I think this is pretty simple but I've been having some trouble - so here I am.

I have 2 .csv files with one column of data in each, ie;

a.csv;
1
2
3
4

and b.csv;
2
4
6
8

and I would like to merge them into on .csv file (or even .ods if possible) with ';' or ',' separated variables into something like this:

all.csv;
1; 2
2; 4
3; 6
4; 8

Any help would be appreciated, I've been trying to mess around with the 'join' and 'cat' commands with no luck.

Again, apologies for my newbness.

Swizz.
 
Old 11-27-2010, 07:22 AM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Code:
bash-4.1$ paste -d\; a.csv b.csv
1;2
2;4
3;6
4;8
 
Old 11-27-2010, 07:31 AM   #3
Swizzgard
LQ Newbie
 
Registered: Nov 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Hi,

Thanks for the quick reply - I was thinking it was a simple problem, which makes me feel like a complete dumbass now!

Cheers,

Swizz.
 
Old 11-27-2010, 08:43 AM   #4
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Oh, come on, don't be so hard on yourself, if you have the right command it is easy, but if you don't, it's hard.

Try using 'apropos' to find commands that might be useful. For example 'apropos merge' and take a look at the commands. Really apropos "merge lines" gives you only paste as an option.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CSV | GAWK | Record merge problem! lmedland Programming 4 07-30-2008 09:10 AM
Comparing two csv files and write different record in third CSV file irfanb146 Linux - Newbie 3 06-30-2008 10:15 PM
CSV file merge help lmedland Programming 2 06-04-2008 12:11 PM
CSV Merge CorvusE Programming 3 12-12-2007 04:37 PM
help editing .csv files schneidz Programming 7 06-11-2005 05:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration