You're viewing a comment by Nirmal Arri and its responses.

Nirmal Arri Permalink
October 08, 2012, 14:58

Hi Peter,
I highly appreciate this article, and all the effort you have put in. Here is my question.

I need to replace a line which starts with a word "update" and ends with "where", I have the following that works fine it there is only one "where" in the line, but doesn't work if there are more than one "where".

sed -e 's/^Update.*where//ig' and I pipe to replace that string with something I want it to be.

Any help would be highly appreciate..



Comment Responses

October 10, 2012, 01:47

Use sed pattern matching and nesting:

sed -e '/^Update/{/where$/{s/.../.../ig}}'

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "floppy_95": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.