user2186138
user2186138

Reputation: 347

How to remove a line with space using sed?

I want to remove a line which begins with <Field name="LastDate" in a xml file.

The space seems to be creating issues here sed -i /^<Field name="LastDate"/d test.xml. How do I go about this?

Upvotes: 2

Views: 62

Answers (1)

Chris Seymour
Chris Seymour

Reputation: 85883

You need to quote the script (single quotes as the text already contains double quotes):

$ sed -i '/^<Field name="LastDate"/d' test.xml

Upvotes: 2

Related Questions