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

Re: Including ' in a sed command



>> On Thu 07 Aug 2025 at 22:18:07 (-0400), Tim Woodall wrote:

> sed 's/["'"'"']//'
> This matches " or '. It works.
> But it's 'unreadable' and almost impossible to find the typo if it's wrong.

  I'm late to this party, but GNU sed lets you use the hex values for
  single and double quotes:

    me% cat quotes
    This line "has" a 'bunch' of quotes.

    me% sed -e 's/[\x22\x27]//g' quotes
    This line has a bunch of quotes.

-- 
Karl Vogel                      I don't speak for anyone but myself

She ran the whole gamut of emotions, from A to B.
                        --Dorothy Parker's review of Katherine Hepburn


Reply to: