我有三个文件,其中包含 n 行,如下所示
样本1.txt
------------------------------
Date Time Name
------------------------------
2013/10/12 12:09:09 Krish
2013/10/12 13:12:01 Ramb
2013/10/12 15:28:39 Likha
2013/10/12 15:56:12 Mat
.
.
.
样本2.txt
------------------------------
Date Time Name
------------------------------
2013/10/12 11:19:21 Jack
2013/10/12 12:11:09 Rob
2013/10/12 15:45:12 Rick
2013/10/12 22:11:10 Phil
.
.
.
样本3.txt
------------------------------
Date Time Name
------------------------------
2013/10/12 12:09:09 Eric
2013/10/12 13:12:01 Bob
2013/10/12 15:28:39 Mike
2013/10/12 15:56:12 Nick
.
.
.
我需要通过排除 Sample2.txt 和 Sample3.txt 中的标题(前 3 行)将这三个文件合并到一个文件(Master.txt)中,如下所示
所需输出
$cat Master.txt
------------------------------
Date Time Name
------------------------------
2013/10/12 12:09:09 Krish
2013/10/12 13:12:01 Ramb
2013/10/12 15:28:39 Likha
2013/10/12 15:56:12 Mat
2013/10/12 11:19:21 Jack
2013/10/12 12:11:09 Rob
2013/10/12 15:45:12 Rick
2013/10/12 22:11:10 Phil
2013/10/12 12:09:09 Eric
2013/10/12 13:12:01 Bob
2013/10/12 15:28:39 Mike
2013/10/12 15:56:12 Nick
注意:在具有 Ksh 88 的 AIX 机器中
答案1
{ cat sample1.txt; tail -n +4 sample2.txt; tail -n +4 sample3.txt; } > out.txt
答案2
sed '4,${/^---/d;/^Date/d;}' sample1.txt sample2.txt sample3.txt > out.txt