我已经编写了一个shell脚本,用于替换属性文件中的某些属性。但脚本运行后,在替换之前文件末尾没有空行。使用echo和sed后缺少空行
file=my_file.properties
file_content=$(cat $file | sed "[email protected]=.*@[email protected]") #making a=b
file_content=$(echo "${file_content}" | sed "[email protected]=.*@[email protected]") #making x=y
echo "${file_content}" > $file
my_file.properties是一样的东西
1)a=v
2)b=c
3)x=b
4)
注有空白行中end.These数字只是用于参考显示空行
在问题中添加文件'my_file.properties'的一些示例内容。 – GurV