|
From: | Raul Libório |
Subject: | Re: [shell-script] Pegar apenas linhas especificas |
Date: | Tue, 25 Jul 2017 17:24:13 -0300 |
Opa, pessoal.
Eu preciso os dados das linhas com o conteúdo "lease" e "hardware ethernet", achei a seguinte solução que deu certo: sed -n '/lease/{h;g;p};/hardware/{h;
g;p};'dhcp.log. Vocês conhecem alguma outra solução além dessa para pegar os dados de linha especificas?
Dados:
# The format of this file is documented in the dhcpd.leases(5) manual page.
lease 10.0.0.46 {
starts 1 2017/07/17 18:20:50;
ends 1 2017/07/17 19:04:07;
tstp 1 2017/07/17 19:04:07;
cltt 1 2017/07/17 18:20:50;
binding state free;
hardware ethernet b3:bb:1f:22:2a:61;
}
lease 10.0.0.50 {
starts 1 2017/07/17 18:30:08;
ends 1 2017/07/17 20:30:08;
tstp 1 2017/07/17 20:30:08;
cltt 1 2017/07/17 18:30:08;
binding state free;
hardware ethernet 2a:cc:cc:d1:ab:cf;
}
lease 10.0.0.48 {
starts 5 2017/07/21 14:12:20;
ends 5 2017/07/21 16:12:20;
tstp 5 2017/07/21 16:12:20;
cltt 5 2017/07/21 14:12:20;
binding state free;
hardware ethernet 1d:aa:fd:31:0b:0a;
}
lease 10.0.0.40 {
starts 5 2017/07/14 13:44:36;
ends 5 2017/07/21 13:44:36;
tstp 5 2017/07/21 13:44:36;
cltt 5 2017/07/14 13:44:36;
binding state free;
hardware ethernet 11:30:xd:b3:xx:da;
--Raul Libório
http://rauhmaru.blogspot.com/
openSUSE Member | Linux User #4444581
/etc/httpd/conf.d/ssl.conf:7
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
[Prev in Thread] Current Thread [Next in Thread]
- Pegar apenas linhas especificas, andrelucio . fc, 2017/07/25
- Re: [shell-script] Pegar apenas linhas especificas, Raul Libório <=
- Re: [shell-script] Pegar apenas linhas especificas, Cleiton Alves, 2017/07/25
- Re: [shell-script] Pegar apenas linhas especificas, Raul Libório, 2017/07/25
- Prev by Date: Pegar apenas linhas especificas
- Next by Date: Re: [shell-script] Pegar apenas linhas especificas
- Previous by thread: Pegar apenas linhas especificas
- Next by thread: Re: [shell-script] Pegar apenas linhas especificas
- Index(es):