简体   繁体   中英

sed command to delete starting pattern match with special character in it

I have sed command that delete line when string match with starting pattern

sed -i "/^Data\\=C\\b/Id" tally.ini

This work correctly for patch Data=C

But I want to match path Data=C:\\ and that I want to delete this line.

How can this possible?

sed -i  '/^Data\=C:\\/Id' tally.ini

Put the command in a single quoted string instead of double. Escape the backslash.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM