sed - copy paste a line into another file at the same position in bash -
i want copy line 30 1 specific file , paste line 30 in file. cannot manually because files big (20 gb+)
i have found out how append end of file:
awk 'nr==30' file1.txt >> file2.txt
how specify line file2?
you can't using redirection mechanism. perhaps suggest perl script (or awk, given you're using awk already), reads line, writes it, , slips new line in @ appropriate place.
my $count = 0; while (<input>) { print output $_; if ($count == 30) { print output $linetobeinserted; } $count++; }
note how doesn't store whole file in memory merely each line @ time.
Comments
Post a Comment