Re: Sed - insert character between tag

Bruno Galindro da Costa <bruno.galindro@xxxxxxxxx> writes:

Hi all!

I have a text file with this content:

VAR_1="xyz "abcd" fgh"

Using sed, how can I insert a backslash before the two quotes between the
first and last quote?

e.g.: VAR_1="xyz \"abcd\" fgh"

sed -r 's/"/\\"/g;s/\\"/"/;s/(.*)\\"/\1"/'

Maybe there's something more elegant...


ubuntu-users mailing list
Modify settings or unsubscribe at: