Replace field with commas with field without commas


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Replace field with commas with field without commas
# 1  
Old 11-18-2011
Replace field with commas with field without commas

Hey guys,

I have the following text:
Code:
1,2,3,4,5,6,'NULL','when',NULL,1,2,0,'NULL'
1,2,3,4,5,6,'NULL','what','NULL',1,2,0,1

I need the same text with the word NULL without commas
u know something like this:
Code:
1,2,3,4,5,6,NULL,'when',NULL,1,2,0,NULL
1,2,3,4,5,6,NULL,'what','NULL',1,2,0,1

thanxs in advance

Moderator's Comments:
Mod Comment Please use code tags when posting data and code samples, thank you.

Last edited by Franklin52; 11-19-2011 at 10:39 AM..
# 2  
Old 11-18-2011
Try this:

Code:
 sed "s/'NULL'/NULL/g" infile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove quotes and commas from field

In the attached file I am trying to remove all the "" and , (quotes and commas) from $2 and $3 and the "" (quotes) from $4. I tried the below as a start: awk -F"|" '{gsub(/\,/,X,$2)} 1' OFS="\t" enhancer.txt > comma.txt Thank you :). (6 Replies)
Discussion started by: cmccabe
6 Replies

2. Shell Programming and Scripting

Nth field should have space and rest commas

Hello I was working on a script where the output of my file is 1234 4567 8973 43214 78965 I need the value in below format of this file.The nth field should have space instead of ,(comma) 1234,4567,8973,43214 78965 I tried the code but not working completely xargs <temp_PP.7250... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

3. Linux

How do I format a Date field of a .CSV file with multiple commas in a string field?

I have a .CSV file (file.csv) whose data are all enclosed in double quotes. Sample format of the file is as below: column1,column2,column3,column4,column5,column6, column7, Column8, Column9, Column10 "12","B000QRIGJ4","4432","string with quotes, and with a comma, and colon: in... (3 Replies)
Discussion started by: dhruuv369
3 Replies

4. Shell Programming and Scripting

Inverted commas replace

Hi, My input file is like this chr1 + "NM_1234" chr1 - "NM_1234" If I want my third column to contain both the first and second column values, how do I do it? I know how to do it by including the column numbers, but I want the values before the inverted commas. So, my output would... (5 Replies)
Discussion started by: jacobs.smith
5 Replies

5. Shell Programming and Scripting

Replace commas with newlines

Good afternoon, I am trying to read user input. Here is what I have so far: echo "Type the Container ID for every container that you want subnets exported" echo "for (with comma between each one, for example... 1,45,98)" echo -n "if you want every one listed, then just type ALL in caps... (2 Replies)
Discussion started by: brianjb
2 Replies

6. Shell Programming and Scripting

CSV with commas in field values, remove duplicates, cut columns

Hi Description of input file I have: ------------------------- 1) CSV with double quotes for string fields. 2) Some string fields have Comma as part of field value. 3) Have Duplicate lines 4) Have 200 columns/fields 5) File size is more than 10GB Description of output file I need:... (4 Replies)
Discussion started by: krishnix
4 Replies

7. Shell Programming and Scripting

replace but skip data between certain commas

OK, I am one needy dude. However, how can I make the program NOT change any of the values BETWEEN the first and second "," ? I dont want any of the numbers changed that are preceded by "AT". I want ALL other numeric values > 300 changed to 300. cat qin.csv |head... (4 Replies)
Discussion started by: herot
4 Replies

8. Shell Programming and Scripting

parsing log files, removing spaces and replace with commas

Hello all i am working on a database to import log files from my systems, but i cannot seem to find the answer. I searched here for a good bit and couldnt peice together what i was looking for. I know you could do this with awk, i just dont know how. Any help would be greatly appreciated.... (6 Replies)
Discussion started by: caddyjoe77
6 Replies

9. Shell Programming and Scripting

replace one or more tabs with commas

Hi, Can any one tell me how to replace one or more tabs from start of the line and in between the words with commas in the file using unix commands? My actual data in the text file is as below with spaces.The spaces are not being shown in the post..please see them while replying to the post.... (1 Reply)
Discussion started by: tucs_123
1 Replies

10. UNIX for Dummies Questions & Answers

Inserting commas and replacing backslashes with commas

Hi, Newbie here. I have a file that consists of data that I want to convert to a csv file. For example: Jul 20 2008 1111 / visit home / BlackBerry8830/4.2.2 Profile/MIDP-2.0 Configuration/CLOC-1.1 VendorID/105 Jul 21 2008 22222 / add friend / BlackBerry8830/4.2.2 Profile/MIDP-2.0... (3 Replies)
Discussion started by: kangaroo
3 Replies
Login or Register to Ask a Question