Find and replace over multiple lines using sed in Xcode Run Script bin/sh
问题 I have a Cocos2D tmx file which is very much like an xml and includes carriage returns and spaces. My requirements are: In every tmx file in Resources/maps_sideScrolling/ find and everything between <tileset firstgid="1" and the first occurring <layer name="background" and replace with the contents of Resources/maps_sideScrolling/tileProperties.txt I've tried the following with no result. The problem is caused by the string to be searched has multiple lines. sed -i '' 's{<tileset firstgid="1.