how to convert this file into comma delimited format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to convert this file into comma delimited format
# 1  
Old 08-28-2009
how to convert this file into comma delimited format

Hi experts,
I need urget help! I have the a text file with this format:

Types of fruits
Name of fruits
1,1
Farm_no,1
apple,1
pineapple,1
grapes,1
orange,1
banana,1
2,2--->this is the record seperator
Farm_no,2
apple,1
pineapple,1
grapes,3
orange,2
banana,1
3,3--->this is the record seperator
Farm_no,3
apple,4
pineapple,2
grapes,3
orange,2
banana,0

I need to parse this txt file into csv format.

The output need to look like this:

FARM_no,apple,pineapple,grapes,orange,banana
1,1,1,1,1,1
2,1,1,3,2,1
3,4,2,3,2,0

Anyone have any idea?Please help!

Thank a lot!

Thanks.
# 2  
Old 08-28-2009
Closed, double post. Read the rules!

Continue here:
https://www.unix.com/unix-advanced-ex...ed-format.html
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Need help on an old post - How to convert a comma delimited string to records or lines of text?

Hi, Apologies in advance to the moderator if I am posting this the wrong way. I've searched and found the solution to an old post but as it is a very old post, I don't see an option to update it with additional question. The question I have is in relation to the following post: How to... (6 Replies)
Discussion started by: newbie_01
6 Replies

2. Shell Programming and Scripting

Linux convert Comma delimited file to pipe

I have file in linux with comma delimited and string fields in double quotations ", I need to convert them to pipe delimiter please share your inputs. Example: Input: "2017-09-30","ACBD,TVF","01234",NULL,18,NULL,"686091802","BANK OF ABCD, LIMITED, THE",790456 Output: ... (4 Replies)
Discussion started by: shieksir
4 Replies

3. Shell Programming and Scripting

UNIX/PERL script to convert XML file to pipe delimited format

Hello, I need to get few values from a XML file and output needs to be written in another file with pipe delimited format. The Header & Footer of the Pipe Delimited file will be constant. The below is my sample XML file. I need to pull the values in between the XML tags <Operator_info to... (15 Replies)
Discussion started by: karthi1305561
15 Replies

4. UNIX for Dummies Questions & Answers

How to convert a comma delimited string to records or lines of text?

Hi, I am not sure if I've posted this question before. Anyway, I previously asked about converting lines of text into a comma delimited string. Now I am needing to do the other way around ... :( :o Can anyone advise how is this possible? Example as below: Converting records/lines to... (2 Replies)
Discussion started by: newbie_01
2 Replies

5. Shell Programming and Scripting

Need a script to convert comma delimited files to semi colon delimited

Hi All, I need a unix script to convert .csv files to .skv files (changing a comma delimited file to a semi colon delimited file). I am a unix newbie and so don't know where to start. The script will be scheduled using cron and needs to convert each .csv file in a particular folder to a .skv... (4 Replies)
Discussion started by: CarpKing
4 Replies

6. UNIX for Dummies Questions & Answers

appending a command to print a file in a comma delimited format

Hi everyone, i have a file that I had grep'd from something else lets call it file1.txt which consists variable files and lines due to different scenarios/inputs 1782 9182 fe35 ac67 how can I print this in this manner? 1782,9182,fe35,ac67 also if i had piped the new output... (2 Replies)
Discussion started by: prodigy06
2 Replies

7. Shell Programming and Scripting

how to convert comma delimited file to tab separator

Hi all, How can i convert comma delimited .csv file to tab separate using sed command or script. Thanks, Krupa (4 Replies)
Discussion started by: krupasindhu18
4 Replies

8. UNIX for Dummies Questions & Answers

How to convert a text file into tab delimited format?

I have a text file that made using text editor in Ubuntu. However the text file is not being recognized as space or tab delimited, the formatting seems to be messed up. How can I convert the text file into tab delimited format? (3 Replies)
Discussion started by: evelibertine
3 Replies

9. UNIX for Advanced & Expert Users

Urgent! need help! how to convert this file into comma delimited format

Hi experts, I need urget help! I have the a text file with this format: Types of fruits Name of fruits 1,1 Farm_no,1 apple,1 pineapple,1 grapes,1 orange,1 banana,1 2,2--->this is the record seperator Farm_no,2 apple,1 pineapple,1 grapes,3 orange,2 banana,1 3,3--->this is the... (2 Replies)
Discussion started by: natalie23
2 Replies

10. Shell Programming and Scripting

Convert comma text file to Column in html format

I am trying to generate a report with below file : File1 : EQADM,edrtere9-phys,8122caef0,gpatmon,/bin/ksh,nuten Erick EQADM,edrtere11-phys,8227caef0,gpatmon,/bin/ksh,nuten Erick EQADM,edrtere3-phys,822caef0,gpatmon,/bin/ksh,nuten Erick can you help me convert it to html and add... (9 Replies)
Discussion started by: sriram003
9 Replies
Login or Register to Ask a Question