Joining and sorting with csvs with subfields


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Joining and sorting with csvs with subfields
# 1  
Old 10-24-2014
Joining and sorting with csvs with subfields

hello masters,

I am working with csv files that open just fine in excel, but have sub-fields which are comma separated as well.

a 3 column csv looks like

Code:
a,b,"c,d,e"
f,g,h

How do I make join or sort believe that "c,d,e" is just 1 field?
# 2  
Old 10-24-2014
Did you do a search on these fora? That question of yours has been answered umpteen times... to and fro...
# 3  
Old 10-24-2014
sorry about that, maybe i am not searching with the correct keywords..would you please direct me to a thread?
# 4  
Old 10-24-2014
What is the desired output...
# 5  
Old 10-24-2014
I want to sort and join with other files.. and I want the super-field col 3 on the final join output..

so to make up stuff

If there are 2 files

Code:
a,b,"c,d,e"
f,g,h

and 
a,1,
f,2,"j,j"

I want to join and get

Code:
a,b,"c,d,e",1
f,g,h,2,"j,j"

# 6  
Old 10-24-2014
Do you have to use join cant you use awk for processing this...
# 7  
Old 10-24-2014
I would prefer to have a join solution, since I try to frequently use it, but awk will be fine too.. I will try to learn and adapt Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Join 2 CSVs based on 1 key

Hello, I have 2 csv as follows: a.csv: name,phone,adress,car xy,1234,asbd yz,2134,asbdf tc,6789,salkdur b.csv: telphone,vehicle 2134,toyota 6789,bmw 1234,honda What is need is this: output.csv: name,phone,adres,car xy,1234,asbd,honda yz,2134,asbdf,toyota (7 Replies)
Discussion started by: Zam_1234
7 Replies

2. Shell Programming and Scripting

Merge csvs with column headers

hello gurus, Somebody must have done this before, I couldn't find anything. Please redirect me if this was solved before, and if not please help. To the problem now, I have multiple csv files (about 1000) which I need to concatenate by column header. The final file should have a superset... (4 Replies)
Discussion started by: abh.kumar
4 Replies

3. Shell Programming and Scripting

Lookup subfields from 3 tables and insert

Hello masters, Please help on the following. I have a tab delimited file with subfields space delimited. 1 a b x y hhghd ghgf 2 v t f g gdgdgdg hghg I have 3 lookup table files tab delimited, for fields 2,3 and 4 respectively Lookup2 a 10 b 20 v 30 t 40 Lookup3 (12 Replies)
Discussion started by: ritakadm
12 Replies

4. UNIX for Dummies Questions & Answers

File joining and sorting

Hi, I'm having some trouble joining these two files for some reason. Here is what they look like: head * I'm using: join -a 1 -1 2 -2 1 f1 f2 -t, > joinfile.out but unfortunately nothing is happening. I did notice that I was having trouble sorting f1 and I'm not sure why using:... (6 Replies)
Discussion started by: verse123
6 Replies

5. Shell Programming and Scripting

Joining

I do have many files of the following format. File_1.txt 1 24 2 25 3 27 4 28 5 29 6 1 File_2.txt 2 5 3 8 4 9 5 10 File_3.txt (3 Replies)
Discussion started by: Lucky Ali
3 Replies

6. Shell Programming and Scripting

Changing exact matches with awk from subfields

To give you some context of my issue the following is some sample dummy data. The field delimiter is "<-->". The 4th field is going to be tags for my notes. The tags should always be unique and sorted alphabetically. 1<-->01/20/12<-->01/20/12<-->1st note<-->1st note<-NL->2 lines... (4 Replies)
Discussion started by: adamreiswig
4 Replies

7. Shell Programming and Scripting

Need help joining lines

Hi All, I need the command to join 2 lines into one. I found lots of threads but none give me the sollution. Probably because unix scripting is one of my best features ;) I got a logfile where line 2 needs to be joined with line 1, lines 4 needs to be joined with line 3 etc If you need... (16 Replies)
Discussion started by: rene21976
16 Replies

8. Shell Programming and Scripting

Joining of Commands.

Hello, i have a few questions which i hope you guys can address. the 1st prob: The database i am using is a text file which displays the information like this : Title : Quantity : Price Persia : 30 : 20 ... (5 Replies)
Discussion started by: gregarion
5 Replies

9. Shell Programming and Scripting

Transposing column to row, joining with another file, then sorting columns

Hello! I am very new to Linux and I do not know where to begin... I have a column with >64,000 elements (that are not in numberical order) like this: name 2 5 9 . . . 64,000 I would like to transpose this column into a row that will later become the header of a very large file... (2 Replies)
Discussion started by: doobedoo
2 Replies

10. UNIX for Dummies Questions & Answers

joining files

Hi, Could anyone help me ? I'm trying to join two files, but no common field are on them. So I think on generate \000\ sequence to add for each line on both files, so then will be able to join these files. Any idea? Thanks in advance, (2 Replies)
Discussion started by: Manu
2 Replies
Login or Register to Ask a Question