shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pegar IP da linha anterior a linha do match


From: itamarnet
Subject: Re: Pegar IP da linha anterior a linha do match
Date: 18 Nov 2019 22:35:17 +0000

Que tal:

awk '/[0-9]+$/{ip=$NF};/Device type:/{print ip}'

ou

awk '/Device type:/{print ip;next};{ip=$NF}'

ou

awk '{if ($0 ~ /Device type:/){print ip} else {ip=$NF}}'

ou

awk '{if ($0 ~ /Device type:/)print ip; else ip=$NF}'

[]'s

reply via email to

[Prev in Thread] Current Thread [Next in Thread]