Сначала несколько тестовых файлов:
$ cat foo
11
12
13
$ cat bar
21
22
23
Одним из способов является использование tail
.man tail
:
-n, --lines=[+]NUM
output the last NUM lines, instead of the last 10; or use -n +NUM
to output starting with line NUM
так:
$ tail -n +2 foo
12
13
но:
$ tail -n +2 foo bar
==> foo <==
12
13
==> bar <==
22
23
О, нет, нам нужен цикл вокруг него:
$ for f in foo bar ; do tail -n +2 "$f" ; done
12
13
22
23
Другим способом является использование awk:
Документация GNU awk говорит:
FNR
FNR is the current record number in the current file. FNR is incremented
each time a new record is read (see section Explicit Input with getline).
It is reinitialized to zero each time a new input file is started.
так:
$ awk 'FNR>1' foo bar
12
13
22
23
Наконец,вам нужно перенаправить вывод в новый файл (one_file
), например:
$ awk 'FNR>1' foo bar > one_file
$ cat one_file
12
13
22
23