プロパティファイルのいくつかのプロパティを置き換える1つのシェルスクリプトを作成しました。スクリプトの実行後、置換前に存在していたファイルの最後に空白行はありません。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は、空白行がend.These数字であり
1)a=v
2)b=c
3)x=b
4)
ノートのようなものであるだけで($(…)
Command Substitutionを参照してthe Bash manualから空行
質問にファイル 'my_file.properties'のサンプルコンテンツを追加してください。 – GurV