[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Filtrar linhas em um arquivo
From: |
Gentil de Bortoli Júnior |
Subject: |
Re: [shell-script] Filtrar linhas em um arquivo |
Date: |
Thu, 03 Feb 2005 15:45:12 -0200 |
User-agent: |
Mozilla Thunderbird 1.0 (X11/20041206) |
Vinicius, aí vai uma idéia:
$ cat tira.sh
#!/bin/bash
while read linha; do
valor1=`echo $linha|cut -d" " -f3|cut -d"-" -f1|cut -d"/" -f1`
valor2=`echo $linha|cut -d" " -f3|cut -d"-" -f1|cut -d"/" -f2`
if [ ${valor1} != ${valor2} ]; then
echo ${linha} | tr " " "\t"
fi
done < <(cat arquivo.txt | tr -s " ")
[]s
Gentil.
Vinão wrote:
CG32-C1.F CA26-C1.F 160/163-163
CG32-C1.F CA26-C1.F 245/243-243
CG32-C1.F CA26-C1.F 245/243-243
CG32-C1.F CA26-C1.F 146/143-143
CG32-C1.F CA26-C1.F 146/143-143
CR05-C3.F CA26-C1.F 234/243-243
CR05-C3.F CA26-C1.F 196/196-196
>
Pro exemplo a linha:
CR05-C3.F CA26-C1.F 196/196-196
Cai fora porque 196-196 = 0