msoliver
(usa Debian)
Enviado em 26/02/2022 - 20:14h
Minions escreveu:
Mesmo ativado no arquivo aparece desativado no grep -Ei
$ cat ~/.fluxbox/init | grep session.screen0.allowRemoteActions
session.screen0.allowRemoteActions: true
$ grep -Ei "session.screen0.allowRemoteActions:[\t ]+true" ~/.fluxbox/init && echo ativado || echo desativado
desativado
Minions, desculpe, ERREI!
Segue correção:
printf "allowRemoteActions:\t True\n"|grep -Ei 'allowRemoteActions:[[:blank:] ]+True'
allowRemoteActions: True
printf "allowRemoteActions:\t True\n"|grep -Ei 'allowRemoteActions:[[:space:] ]+True'
allowRemoteActions: True
--------------------------------------------------------------------------------------------------------
printf "allowRemoteActions:\t true\n"|grep -Eiq 'allowRemoteActions:[[:space:] ]+true' && echo "Ativado" || echo "Desativado"
Ativado
--------------------------------------------------------------------------------------------------------
printf "allowRemoteActions:\t false\n"|grep -Eiq 'allowRemoteActions:[[:space:] ]+true' && echo "Ativado" || echo "Desativado"
Desativado
---------------------------------------------------------------------------------------------------
Apelando.... :)
printf "allowRemoteActions:\t True\n"|grep -Ei 'allowRemoteActions:.*True$'
Para casar tabulação no grep, use [[:blank:]], [[:space:]], .*, Ctrl+V+Tab, etc....
No sed, que é [\t]:
printf "allowRemoteActions:\t True\n"|sed -r 's/allowRemoteActions:[\t ]+//'
printf "allowRemoteActions:\t true\n"|sed -nr '/allowRemoteActions:[\t ]+true$/p'
______________________________________________________________________
Importante:
lynx --dump
https://www.vivaolinux.com.br/termos-de-uso/ | sed -nr '/^[ ]+Se/,/dou.$/p'
______________________________________________________________________
Nota de esclarecimento:
O comando:
ACIMA, faz parte da minha assinatura.
Att.: Marcelo Oliver
______________________________________________________________________