Replace double quotes inside the string data for all the columns


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Replace double quotes inside the string data for all the columns
# 15  
Old 05-19-2018
I'd be surprised if the sed version gave a noticeable performance improvement over the awk solution, but if it did, I'd ask you to report back some numbers. Try
Code:
sed 's/"/""/g; s/"\?|"\?/|/g; /|/ s/^"\|"$//g' file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace Double quotes within double quotes in a column with space while loading a CSV file

Hi All, I'm unable to load the data using sql loader where there are double quotes within the double quotes As these are optionally enclosed by double quotes. Sample Data : "221100",138.00,"D","0019/1477","44012075","49938","49938/15043000","Television - 22" Refurbished - Airwave","Supply... (6 Replies)
Discussion started by: mlavanya
6 Replies

2. Programming

Replace comma which is not inside brackets,quotes or paranthesis

Hi All, I want to replace the commas which are not inside parenthesis,quotes if input is abc,,lm,(no,pq,rs),{tu,vw,xy},zs,"as,as,fr",'ab,cd,ef' output should be abc lm (no,pq,rs) {tu,vw,xy} zs "as,as,fr" 'ab,cd,ef' I tried this str.replaceAll("\\(.*?\\)|(,)", " "); say my string... (3 Replies)
Discussion started by: preethy
3 Replies

3. Shell Programming and Scripting

sed command to replace string that contain blackslash,double quotes

Hi All, I have been trying to replace a string using the sed command string value contain blackslash and double quotes. I am not a expert writer of unix script but do try not to ask question. I have almost given up. Hope you all can give me some suggestion I want to replace a place string... (6 Replies)
Discussion started by: thanush9sep
6 Replies

4. Shell Programming and Scripting

Replace double quotes with a single quote within a double quoted string

Hi Froum. I have tried in vain to find a solution for this problem - I'm trying to replace any double quotes within a quoted string with a single quote, leaving everything else as is. I have the following data: Before: ... (32 Replies)
Discussion started by: pchang
32 Replies

5. Shell Programming and Scripting

Preserve commas inside double quotes (perl)

Hi, I have an input file like this $ cat infile hi,i,"am , sam", y hello ,good, morning abcd, " ef, gh " ,ij no, "good,morning", yes, "good , afternoon" from this file I have to split the fields on basis of comma"," however, I the data present inside double qoutes should be treated as... (3 Replies)
Discussion started by: sam05121988
3 Replies

6. Shell Programming and Scripting

Replace double double quotes using AWK/SED

Hi, I have data as "01/22/97-"aaaaaaaaaaaaaaaaa""aaa""aabbbbbbbbcccccc""zbcd""dddddddddeeeeeeeeefffffff" I want to remove only the Consequitive double quotes and not the one which occurs single. My O/P must be ... (2 Replies)
Discussion started by: Bhuvaneswari
2 Replies

7. Shell Programming and Scripting

To append two columns without double quotes

Hi i have a file with follw data "20090427","0","","16371311","-100200","","","","16371311","JUL","09" In the 10th column i need to convert the month name into month number in this case JUL will be 7 and append the 10th and 11th column which shows me the output as 709. Can you suggest a shell... (11 Replies)
Discussion started by: vee789
11 Replies

8. Shell Programming and Scripting

To Replace comma with Pipe inside double quotes

Hi, I have a requirement to replace the comma's inside the double quotes. The comma's inside the double quotes will get changed dynamically. Input Record: "Washington, DC,Prabhu,aju",New York Output Record: "Washington| DC|Prabhu|aju",New York I tried with the below command but it... (3 Replies)
Discussion started by: prabhutkl
3 Replies

9. Shell Programming and Scripting

sed removing comma inside double quotes

I have a csv file with lines like the followings 123456,"ABC CO., LTD","XXX" 789012,"DEF LIMITED", "XXX" before I bcp this file to database, the comma in "CO.," need to be removed first. My script is cat <filename> | sed 's/"CO.,"/"CO."/g' but it doesn't work. Can anyone here able to... (2 Replies)
Discussion started by: joanneho
2 Replies

10. Shell Programming and Scripting

escaping double-quotes inside the script?

I'm having a strange problem with escaping double-quotes. I have a script that looks like this: #!/bin/bash for HOST in `cat $INFILE | grep -v ^#` do for VFILER in `some_command` do echo " " echo -e '\E The problem with ssh command... (3 Replies)
Discussion started by: GKnight
3 Replies
Login or Register to Ask a Question
HTMLSPECIALCHARS_DECODE(3)						 1						HTMLSPECIALCHARS_DECODE(3)

htmlspecialchars_decode - Convert special HTML entities back to characters

SYNOPSIS
string htmlspecialchars_decode (string $string, [int $flags = ENT_COMPAT | ENT_HTML401]) DESCRIPTION
This function is the opposite of htmlspecialchars(3). It converts special HTML entities back to characters. The converted entities are: &amp;, &quot; (when ENT_NOQUOTES is not set), &#039; (when ENT_QUOTES is set), &lt; and &gt;. PARAMETERS
o $string - The string to decode. o $flags - A bitmask of one or more of the following flags, which specify how to handle quotes and which document type to use. The default is ENT_COMPAT | ENT_HTML401. Available $flags constants +--------------+---------------------------------------------------+ |Constant Name | | | | | | | Description | | | | +--------------+---------------------------------------------------+ | | | | ENT_COMPAT | | | | | | | Will convert double-quotes and leave single- | | | quotes alone. | | | | | | | | ENT_QUOTES | | | | | | | Will convert both double and single quotes. | | | | | | | |ENT_NOQUOTES | | | | | | | Will leave both double and single quotes uncon- | | | verted. | | | | | | | | ENT_HTML401 | | | | | | | Handle code as HTML 4.01. | | | | | | | | ENT_XML1 | | | | | | | Handle code as XML 1. | | | | | | | | ENT_XHTML | | | | | | | Handle code as XHTML. | | | | | | | | ENT_HTML5 | | | | | | | Handle code as HTML 5. | | | | +--------------+---------------------------------------------------+ RETURN VALUES
Returns the decoded string. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.4.0 | | | | | | | The constants ENT_HTML401, ENT_XML1, ENT_XHTML | | | and ENT_HTML5 were added. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 A htmlspecialchars_decode(3) example <?php $str = "<p>this -&gt; &quot;</p> "; echo htmlspecialchars_decode($str); // note that here the quotes aren't converted echo htmlspecialchars_decode($str, ENT_NOQUOTES); ?> The above example will output: <p>this -> "</p> <p>this -> &quot;</p> SEE ALSO
htmlspecialchars(3), html_entity_decode(3), get_html_translation_table(3). PHP Documentation Group HTMLSPECIALCHARS_DECODE(3)