[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Contar espaço em um arquivo.
From: |
Ultimo de Miranda |
Subject: |
Re: [shell-script] Contar espaço em um arquivo. |
Date: |
Tue, 08 Sep 2015 11:20:31 -0300 |
[miranda@guitar ~]$ cat texto.txt
"123";"teste";"cachorro"
"124";"teste"
"125";"teste";"cachorro"
"126";"teste"
"127";"teste"
"128";"teste";"cachorro"
[miranda@guitar ~]$ awk -F ";" '{if (NF == 2){print}else{printf("\n")}}'
texto.txt |sort
"124";"teste"
"126";"teste"
"127";"teste"
On Mon, 2015-09-07 at 14:38 -0700, 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,
>
>
>