Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove quotes with SED

Tags:

shell

unix

People also ask

How do I remove a quote from a file?

A single line sed command can remove quotes from start and end of the string. The above sed command execute two expressions against the variable value. The first expression 's/^"//' will remove the starting quote from the string. Second expression 's/"$//' will remove the ending quote from the string.

How do you escape quotes in sed?

2.2.3 Double-Quotes In Sed's specification, s command: The meaning of an unescaped backslash immediately followed by any character other than '&', backslash, a digit, newline, or the delimiter character used for this command, is unspecified.

How do you remove double quotes in output?

To remove double quotes just from the beginning and end of the String, we can use a more specific regular expression: String result = input. replaceAll("^\"|\"$", ""); After executing this example, occurrences of double quotes at the beginning or at end of the String will be replaced by empty strings.

How do I remove a single quote from a string in Unix?

A single quote is not used where there is already a quoted string. So you can overcome this issue by using a backslash following the single quote. Here the backslash and a quote are used in the “don't” word. The whole string is accompanied by the '$' sign at the start of the declaration of the variable.


Why use sed?

| tr -d '"'

Right tool for the right job.


You can do:

...existing_commands | sed 's/"//g'

A little late to the party, this this utility sounds like it can be useful for parsing the json twitter returns: http://stedolan.github.io/jq/