user3629119
user3629119

Reputation: 151

How to apply sed here?

I have the following string -

<ROM readonly="false" persist="false" type="string" name="rom_code_url">ROMCODE_URL_VAL</ROM>

Now, I want to replace the the ROMCODE_UR_VAL to the following -

dvb://1000.b.2CEC.1/romcode_1.0.xml

How can I do so using SED?

Upvotes: 2

Views: 92

Answers (2)

jweyrich
jweyrich

Reputation: 32240

It's as simple as 's/pattern/replacement/' with proper escaping, or an equivalent expression. for example:

sed 's ROMCODE_URL_VAL dvb://1000.b.2CEC.1/romcode_1.0.xml ' <input-file>

NOTE: The trailing space is important as we're using spaces as delimiters, rather than forward slashes.

Upvotes: 2

Paulo
Paulo

Reputation: 41

If you are doing this in a script, you can try something like piping from stdin:

awk -F"ROMCODE_UR_VAL" '{print $1"dvb://1000.b.2CEC.1/romcode_1.0.xml"$2}'

Upvotes: 0

Related Questions