Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
file1.txtUnixにテキスト ファイルがあります。別のファイルを作成したいと思います。このファイルでは、出現するfile2.txtすべての を に置き換えます。どのコマンドを使用できますか?apple-pieapple_pie
file1.txt
file2.txt
apple-pie
apple_pie
sedでグローバルな置換をfile1.txt行い、出力を にリダイレクトするために使用しfile2.txtます。
sed
sed 's/apple-pie/apple_pie/g' file1.txt > file2.txt