Como posso remover os cabeçalhos

0

Eu gostaria de remover os dois cabeçalhos (que são incidentalmente repetidos). Alguma solução para isso?

[root@report]# iostat -xd 5
Linux 3.10.0-693.21.1.el7.x86_64 (mdds-pgbackup-01)     07/05/2018      _x86_64_        (2 CPU)

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
vda               0.07     0.28    0.31    4.22     9.25    28.56    16.72     0.08   16.70   38.40   15.12   5.92   2.68
scd0              0.00     0.00    0.00    0.00     0.00     0.00     7.99     0.00    0.88    0.88    0.00   0.88   0.00
dm-0              0.00     0.00    0.28    3.01     8.86    28.13    22.50     0.05   16.58   41.32   14.27   8.11   2.67
dm-1              0.00     0.00    0.09    0.11     0.38     0.43     8.04     0.00    6.45    8.44    4.72   1.00   0.02

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
vda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
scd0              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
dm-0              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
dm-1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00

resultado esperado:

[root@report]# iostat -xd 5


vda               0.07     0.28    0.31    4.22     9.25    28.56    16.72     0.08   16.70   38.40   15.12   5.92   2.68
scd0              0.00     0.00    0.00    0.00     0.00     0.00     7.99     0.00    0.88    0.88    0.00   0.88   0.00
dm-0              0.00     0.00    0.28    3.01     8.86    28.13    22.50     0.05   16.58   41.32   14.27   8.11   2.67
dm-1              0.00     0.00    0.09    0.11     0.38     0.43     8.04     0.00    6.45    8.44    4.72   1.00   0.02


vda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
scd0              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
dm-0              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
dm-1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
    
por Fayne 05.07.2018 / 03:20

2 respostas

0

A maneira mais fácil é usar o 'egrep':

iostat -xd 5 | egrep -v "Linux|Device"

egrep imprime linhas com várias strings por meio de expressões regulares estendidas e -v imprime linhas que não contêm as strings que, nesse caso, são "Linux" e "Device".

Saída:

vda               0.07     0.28    0.31    4.22     9.25    28.56    16.72     0.08   16.70   38.40   15.12   5.92   2.68
scd0              0.00     0.00    0.00    0.00     0.00     0.00     7.99     0.00    0.88    0.88    0.00   0.88   0.00
dm-0              0.00     0.00    0.28    3.01     8.86    28.13    22.50     0.05   16.58   41.32   14.27   8.11   2.67
dm-1              0.00     0.00    0.09    0.11     0.38     0.43     8.04     0.00    6.45    8.44    4.72   1.00   0.02


vda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
scd0              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
dm-0              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
dm-1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
    
por 09.07.2018 / 04:13
0
iostat -xd 5 | grep -v '/'

Isso removeria todas as linhas da saída de iostat que contém uma barra, que somente os cabeçalhos fazem.

    
por 09.07.2018 / 08:44