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.
f1awkを使用して、ファイルの先頭に行を追加したいと思います。 以下よりも良い方法はありますか?
f1
awk 'BEGIN{print "word"};{print $0}' f1 > aux;cp aux f1;\rm aux<br/>
awkには-isedのオプションのようなものがありますか?
-i
sed を使用しない理由 - ソリューションがより簡単になります
$sed -i.bak '1i\ word ' <filename>
これを行う別の方法は次のとおりです。
sed -i '1s:^: Word1\nWord2 :' file