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

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

[no subject]


From: lferreir1
Date: Fri, 03 Sep 2004 18:58:31 -0000
User-agent: eGroups-EW/0.82

Wellington, pelo que entendi os arquivos podem ter registros 
diferentes, correto?
Então não vai adiantar muito os comandos tradicionais, como
cmp, 
comm, diff, etc.

Veja se o script abaixo te ajuda:

#!/usr/bin/ksh
IFS='
'

rm saida.txt 2>/dev/null
# ----- VERIFICANDO QUAL EH O ARQUIVO MAIOR -------------
if [ `sed -n $= teste1` -ge `sed -n $= teste2` ]
 then
   ARQ1=teste1;ARQ2=teste2
 else
   ARQ1=teste2;ARQ2=teste1
fi

for PROCURA in `cat ${ARQ1}`
  do
    if test
      grep ${PROCURA} ${ARQ2}
         then
           grep -n ${PROCURA} ${ARQ2} >> saida.txt
    fi
done

Até!
Luiz


--- Em address@hidden, wellingtons_imares@c... 
escreveu
> Galera
> Boa Tarde
> 
>       É o seguinte tenho 2 arquivos "arq1" e o "arq2", o dois 
arquivos
> teriam que ter o mesmos registros mais algum desses arquivos tem um 
ou mais
> registros diferente de um pro outro, agora á questão é a
seguinte 
como faço
> para comparar os dois arquivos para ver se tem e qual é o
registro
> diferente ?
> 
> Obrigado a Todos
> ___________________________________________________
> Wellington Santos Oliveira


reply via email to

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