[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Including ' in a sed command



On 2025-08-08 02:17:29, Tim Woodall wrote:

> iHi All,
> 
> (Typed, rather than cut/pasted so apologies if there's a typo)
> 
> This is part of a sed command in a bash script.
> 
> sed 's/["'"'"']//'
> 
> This matches " or '. It works.
> 
> But it's 'unreadable' and almost impossible to find the typo if it's wrong.
> 
> Is there a better way of writing it? the obvious '["\']' doesn't work.
> 
> Tim.
> 


Hi,

You can also use the octal form like 

   sed 's/'$(printf "\047")'//'

   (\042 for double quotes)

Rand


Reply to: