问题
I want to combine two giant file each few hundred megabyte into a single file while ignoring the first line.
I wanted to use awk as I thought it should be the most optimized way. the way I'm doing it only ignores the first line of second file. Any idea how to do make work or if there's a faster way to do it?
awk 'FNR!=NR && FNR==1 {next} 1' 'FNR!=NR && FNR==1 {next} 2' s_mep_{1,2}.out >> s_mep.out
回答1:
$ awk 'FNR>1' file{1,2} > file_12
回答2:
With sed
(sed '1d' file_1 ; sed '1d' file_2) > new_file
回答3:
Generalizing to arbitrarily many files ...
for f in ... ; do
tail -n +2 "$f" >> well_chosen_filename
done
来源:https://stackoverflow.com/questions/52939685/combining-two-very-large-files-ignoring-the-first-sentence