J.K.Mahapatra J.K.Mahapatra - 7 months ago 14
Bash Question

How to replace the a specific character in sed command which have predefine meaning?

I have this text

" File: 'space folder' "


I want to replace this with only this

" space folder "


using sed or awk?
But when i try to do with it using sed it's not taking the command!
Does anyone have solution for this.

Answer

If I get your intent correctly, you need all text between single quotes; you can use this:

$ sed -r "s/^.*'([^']*)'.*$/\"\1\"/g" <<< "\" File: 'space folder' \""
"space folder"
$
Comments