2023-05-16から1日間の記事一覧
末尾スペースを一括削除する まずechoコマンドで末尾スペースのあるファイルを作成します。 echo -e "hello hello \nworld " > test.txt 次にそのファイルに対してsedで正規表現を利用して一括置換を行います。 sed -i 's/\s+$//g' test.txt これでもよさそ…
末尾スペースを一括削除する まずechoコマンドで末尾スペースのあるファイルを作成します。 echo -e "hello hello \nworld " > test.txt 次にそのファイルに対してsedで正規表現を利用して一括置換を行います。 sed -i 's/\s+$//g' test.txt これでもよさそ…