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

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

Re: [shell-script] Contar espaço em um arquivo.


From: phfbettega
Subject: Re: [shell-script] Contar espaço em um arquivo.
Date: Tue, 8 Sep 2015 12:23:53 -0300
User-agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

Testando o campo $3 como vazio

awk -F";" '$3 ~ /^$/ {i++; print}; END {print i}' <<<'"123";"teste";"cachorro"
"124";"teste"
"125";"teste";"cachorro"
"126";"teste"
"127";"teste"
"128";"teste";"cachorro"'
"124";"teste"
"126";"teste"
"127";"teste"
3




On 07-09-2015 18:38, address@hidden [shell-script] wrote:
Caros Boa Noite,

Tenho um arquivo com seguinte formato:

cat texto.txt

"123";"teste";"cachorro"
"124";"teste"
"125";"teste";"cachorro"
"126";"teste"
"127";"teste"
"128";"teste";"cachorro"


Estou tentando pegar apenas as linhas da terceira coluna vazia. Então
pensei em printar a terceira coluna e aplicar a contagem porem não estou
conseguindo resolver aparti disso. Abaixo segue minha tentativa:


cat texto.txt | awk -F ";" '/^ $/{print $3}' | wc -l


ele me retorna 0


Queria que alem de contar me trouxesse a linha por completo. Por exemplo:


3 linhas vazias


"124";"teste"

"126";"teste"
"127";"teste"


Podem me ajudar?


Att,



------------------------------------------------------------------------
Enviado por: address@hidden
------------------------------------------------------------------------


reply via email to

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