简体   繁体   中英

Command grouping in sed

I do not understand the command grouping in sed scripts. We use curly braces to group commands. I found some information in the first answer to the following question:
Using multiple sed commands .
But I still do not understand this properly. Could someone please explain this to me?

If you use

/Number/ s/N/n/;s/r//

Then r s will be removed on all lines, not only those containing Number . But, if you use

/Number/{s/N/n/;s/r//}

then r s will be removed only from lines containing Number .

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