输入head --help可看到如下解释:
head -n, --lines=[-]NUM # print the first NUM lines instead of the first 10; # with the leading '-', print all but the last NUM lines of each file
意思就是
head -n k # 打印前k行 head -n -k # 打印除最后k行外的所有内容
输入tail --help看到如下解释:
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 k # 打印最后k行 tail -n +k # 从k行开始打印
C选项:sed命令 p :列印,亦即将某个选择的数据印出。通常 p 会与参数 sed -n 一起运行~
sed命令 p :列印,亦即将某个选择的数据印出。通常 p 会与参数 sed -n 一起运行~