Edit csv file with bash


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Edit csv file with bash
# 1  
Old 03-27-2011
Edit csv file with bash

I' trying to use bash to edit a csv file from this format:

"apples","oranges","grapes"
"bread","butter","milk"

To this:

"apples
oranges
grapes"

So that if I would open the csv file in open office,

"apples
oranges
grapes"

Would be in one single cell, and

"bread
butter
millk"

Would also be in one single cell.
# 2  
Old 03-28-2011
Hi locoroco,

This sed line it seems to work

Code:
sed 's/","/\n/g' input

At the moment to open in open office, select " as "Text separator".

Hope it helps,

Regards.

Last edited by cgkmal; 03-28-2011 at 02:10 AM..
This User Gave Thanks to cgkmal For This Post:
# 3  
Old 03-28-2011
thanks

thank you, it works!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash - make csv file

Hello, im trying to make csv file from a text file that it is the output of pssh command (multiple ssh ) now if i run the command date on all of our servers: i get this output : 14:02:46 192.168.25.230:22 Thu Jul 6 14:02:46 EEST 2017 192.168.70.230: Thu Jul 6 12:02:46 BST 2017 ... (1 Reply)
Discussion started by: batchenr
1 Replies

2. Shell Programming and Scripting

[bash] - Replace blank and string in csv file

Hi all, i have a .csv file with only two columns, like: Login;Status Luca;S Marco; Stefano; Elettra;S Laura; ... I need to replace the blank space on Status column whit Enabled end, on the same column, S whit Disabled, like: Login;Status Luca;Disabled Marco;Enabled Stefano;Enabled... (10 Replies)
Discussion started by: kamose
10 Replies

3. UNIX and Linux Applications

GUI to edit and control csv file

Hello, I manage an application with a lot of parameter files under a csv format. I'm looking for a GUI to allow users to edit those files without breaking them. I would like an admin access to define the format of the files (number of columns, format of each column, list of value possible...).... (0 Replies)
Discussion started by: maturix
0 Replies

4. Shell Programming and Scripting

Bash script - add/edit to file and save - sed?

I'm working on a script to execute a number of items. One being, editing particular files to add certain lines. I'm attempting to utilize sed, but, having issues when running from a bash script. Assistance is greatly appreciated. My example: sed -i '14 i\ # add these lines add these lines to... (5 Replies)
Discussion started by: Nvizn
5 Replies

5. Shell Programming and Scripting

Bash script help - removing certain rows from .csv file

Hello Everyone, I am trying to find a way to take a .csv file with 7 columns and a ton of rows (over 600,000) and remove the entire row if the cell in forth column is blank. Just to give you a little background on why I am doing this (just in case there is an easier way), I am pulling... (3 Replies)
Discussion started by: MrTuxor
3 Replies

6. Shell Programming and Scripting

Read csv file in bash

how to I use IFS to read 2 files (csv) and run the followiung script ./naviseccli -h 1.2.3.4 storagegroup -addhlu -gname $hostname -hlu $hlu_num -alu $alu_num the csv file for $hostname is host1 host2 . . . for hlu and alu its alu,hlu (2 Replies)
Discussion started by: tdubb123
2 Replies

7. Shell Programming and Scripting

Convert sql output to csv file via bash tools

hi Can anybody help me with converting such structure into csv file for windows : BAT_ID ID_num CVS_LINE A_SEG SKILL_TO A_CUSTOMER_TYPE --------- ---------- --------------------------------- ---------- ------------------ ----------- 14-MAY-11 777752 ... (4 Replies)
Discussion started by: kvok
4 Replies

8. Shell Programming and Scripting

Edit csv file

I'm trying to replace the content of cell 4A a csv file with another value. The code itself is successful, but when I try to save the newly changed file content into the old file, it doesn't work: awk -F"," 'NR==4{$1="\"newcontent\","$3}1' test.csv | sed 's/ //g' > test.csv It works only if I... (1 Reply)
Discussion started by: locoroco
1 Replies

9. Shell Programming and Scripting

Need to modify csv-file with bash script

Hi Guys, I need to write a script, that exports the "moz_places" table of the "places.sqlite"-file (firefox browser history) into a csv-file. That part works. After the export, my csv looks like this: ... 4429;http://www.sqlite.org/sqlite.html;"Command Line Shell For... (11 Replies)
Discussion started by: Sebi0815
11 Replies

10. Shell Programming and Scripting

How to edit particular cell of csv file using shell script

I have one csv file and in that I want update particular cell. I know the row and coloumn number for that respective. Please help me... (6 Replies)
Discussion started by: deepak_p86
6 Replies
Login or Register to Ask a Question