我有两个文件
文件1:
world,11
文件2:
hello welcome to the ("12345,67")
我正在尝试将上面的内容替换"(12345,67)"
为"world,11"
答案1
根据您发布的内容,我认为这段代码可以解决您的问题:
replacement=`cat replacement.txt`
content=`cat content.txt`
pattern="pattern"
echo "${content//$pattern/$replacement}" # all strings matching will be replaced with $replacement
echo "${content/$pattern/$replacement}" # the first string matching the pattern will be replaced