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.
ある特定のファイルから 30 行目をコピーして、別のファイルの 30 行目に貼り付けたいと考えています。ファイルが大きすぎる (20 GB 以上) ため、これを手動で行うことはできません。
別のファイルの最後に追加する方法を見つけました:
awk 'NR==30' file1.txt >> file2.txt
file2 の行をどのように指定しますか?
とawk:
awk
awk ' NR==30{line=$0;next} NR==FNR{next} FNR==30{$0=line}1 ' file1 file2 > tmp && mv tmp file2