sed如何快速处理ios工程文件的类json

现在有形如如下的类json

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
com.apple.ApplicationGroups.iOS = {
enabled = 0;
};
com.apple.BackgroundModes = {
enabled = 1;
};
com.apple.Push = {
enabled = 1;
};
com.apple.ApplicationGroups.iOS = { enabled = 0; }; com.apple.BackgroundModes = { enabled = 1; }; com.apple.Push = { enabled = 1; };
                            com.apple.ApplicationGroups.iOS = {
                                enabled = 0;
                            };    
                            com.apple.BackgroundModes = {
                                enabled = 1;
                            };    
                            com.apple.Push = {
                                enabled = 1;
                            };

如何把某一个enabled关掉呢?

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sed -i "" "/com.apple.Push = {/,/}/{s/enabled = 1;/enabled = 0;/;}" file
sed -i "" "/com.apple.Push = {/,/}/{s/enabled = 1;/enabled = 0;/;}" file
sed -i "" "/com.apple.Push = {/,/}/{s/enabled = 1;/enabled = 0;/;}" file

 

Leave a Reply

Your email address will not be published. Required fields are marked *