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
ap(8mh) 																   ap(8mh)

Name
       ap - parse addresses RFC 822-style

Syntax
       /usr/lib/mh/ap [ -form file ] [ -format string ] [ -help ] [ -[no]normalize ] [ -width columns ] addrs ...

Description
       The  program  parses  addresses	according to the ARPA Internet standard.  It also understands many non-standard formats.  It is useful for
       seeing how MH will interpret an address.

       The program treats each argument as one or more addresses, and prints those addresses in the official RFC 822 format.  Hence, it is usually
       best to enclose each argument in double quotes (") for the shell.

       In  addition  to  the  standard	escapes,  also recognizes the additional escape error, which is a diagnostic that is returned if the parse
       failed.

Options
       -form file
		 Overrides the default output format of The output is formatted according to the instructions in the specified file.  This must be
		 a format file; see

       -format string
		 Overrides  the default output format of The output is formatted according to the instructions in the specified string.  This must
		 be a format string; see

		 The argument to the -format option must be interpreted as a single token by the shell that invokes Therefore, you should  usually
		 place the argument to this option inside double quotes (").

       -help	 Prints a list of the valid options to this command.

       -normalize
       -nonormalize
		 Tells	to  try  to  find  the	official  host name of the address.  This is the default behavior.  It can be suppressed using the
		 -nonormalize option.

       -width columns
		 Specifies the width of the screen in columns.

       The defaults for this command are as follows:

	      -normalize
	      -width defaults to the width of the terminal

Restrictions
       On systems where MH is configured with the BERK option, address parsing is not enabled.

Examples
       This is the default format string used by
       %<{error}%{error}: %{text}%|%(proper{text})%>
       If an error was detected, this string instructs to print the error, a colon (:), and the address that is in error.  Otherwise,  output  the
       proper RFC 822 format of the address.

Files
       User profile.

       System customization file.

See Also
       mh-format(5mh), dp(8mh)
       Standard for the Format of ARPA Internet Text Messages (RFC 822)

																	   ap(8mh)