J.K.Mahapatra J.K.Mahapatra - 2 years ago 74
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 Source

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"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download