1. Direct substitution
The original file
ARCHS = (
arm64,
x86_64,
);
Copy the code
The resulting file
ARCHS = arm64;
Copy the code
Execute this command, noting that this cannot be written as a line of ARCHS = (replacing the starting character,); Is to replace the end character
sed -i "" '/ARCHS = (/,/); /c\ ARCHS = arm64; \ ' project.pbxprojCopy the code
2. Do not change the source file and save it to a new file
The original file
<! --tokenHeadStart-->\ test\ <! --tokenHeadEnd-->Copy the code
The resulting file
<! - tokenHeadStart - >, < ul >, < li > < a href = "#" > < / a > < img Alt = "warm item big search" SRC = "img/slide - 01. JPG" > < / a > < / li > \ < li > < a Href = "#" > < / a > < img Alt = "socks! Hello meng "SRC =" img/slide - 02. JPG "> < / a > < / li > \ < li > < a href =" # "> < / a > < img Alt =" Moschino joking life "SRC =" img/slide - 03. JPG "> < / a > < / li > \ </ul>\ <! --tokenHeadEnd-->Copy the code
The tokenHeadStart command replaces the start character and tokenHeadEnd replaces the end character
sed '/tokenHeadStart/,/tokenHeadEnd/c\\ <! - tokenHeadStart -- > \ \ < ul > \ \ < li > < a href = "#" > < / a > < img Alt = "warm item big search" SRC = "img/slide - 01. JPG" > < / a > < / li > \ \ < li > < a Href = "#" > < / a > < img Alt = "socks! Hello meng "SRC =" img/slide - 02. JPG "> < / a > < / li > \ \ < li > < a href =" # "> < / a > < img Alt =" Moschino joking life "SRC =" img/slide - 03. JPG "> < / a > < / li > \ \ </ul>\\ <! --tokenHeadEnd-->' file.txt >result.txtCopy the code
Single line to replace
#iconsed -i "" "s/ASSETCATALOG_COMPILER_APPICON_NAME = .*; /ASSETCATALOG_COMPILER_APPICON_NAME = \"${APPICON_NAME}\"; /g" $Pbxproj_Path#The package namesed -i "" "s/PRODUCT_BUNDLE_IDENTIFIER = .*; /PRODUCT_BUNDLE_IDENTIFIER = ${BUNDLE_IDENTIFIER}; /g" $Pbxproj_Path
$plistBuddy -c "Set CFBundleDisplayName \"${d_App_Display_Name}\ "" $Info_Plist_Path
# $plistBuddy -c "Set CFBundleShortVersionString \"${SHORT_VERSION}\ "" $Info_Plist_Path
#Start page
$plistBuddy -c "Set UILaunchStoryboardName \"${LaunchStoryboardName}\ "" $Info_Plist_Path
#The package name
$plistBuddy -c "Set CFBundleIdentifier \"${BUNDLE_IDENTIFIER}\ "" $Info_Plist_Path
Copy the code