我想要打印第二列,但我不想要前10行和后10行。
awk 'NR>10' filename.txt | awk '{ print $2 }'| head --lines=-10
它对我不起作用
答案 0 :(得分:1)
你想要的是:
tail -n+11 filename.txt | head -n-10 | awk '{print $2}'
<强>输入强>
$cat lines_1-40.txt
line 1 in the file
line 2 in the file
line 3 in the file
line 4 in the file
...
line 38 in the file
line 39 in the file
line 40 in the file
<强>输出强>
$ tail -n+11 lines_1-40.txt | head -n-10 | awk '{print $2}'
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30