J.K.Mahapatra J.K.Mahapatra - 1 year ago 43
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.


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"