PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Comparing Files
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Comparing Files

Réponse
 
LinkBack Outils de la discussion
Vieux 24/04/2008, 15h26   #1
invincible
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Comparing Files

all,

Any better ideas on implementing the below....?
..
..
..
..
..
#Listing Missing Processes from the system
>tmp1.out

rsh $server cat /home/basks.tbl >>tmp1.out
if [ -e tmp1.out ]
then
echo "Missing Process on system are " >>check_ps.out
diff tmp1.out proc-list|awk '{ print $2 }' >>check_ps.out
else
echo "File NOT Found !!!! " >>check_ps.out
fi
done

I have a list of processes in proc-list which want to compare with the
ones on the system from /home/basks.tbl

The problem with diff is it gives unwanted spaces in file.

Thankyou


  Réponse avec citation
Vieux 24/04/2008, 15h47   #2
mop2
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Comparing Files

What is "unwanted spaces"?
Is more than one space between words?
For this last:
diff tmp1.out proc-list|awk '{ print $2 }'|tr -s ' ' >>check_ps.out

Sample is best than thousand words.


invincible wrote:
> all,
>
> Any better ideas on implementing the below....?
> .
> .
> .
> .
> .
> #Listing Missing Processes from the system
> >tmp1.out

> rsh $server cat /home/basks.tbl >>tmp1.out
> if [ -e tmp1.out ]
> then
> echo "Missing Process on system are " >>check_ps.out
> diff tmp1.out proc-list|awk '{ print $2 }' >>check_ps.out
> else
> echo "File NOT Found !!!! " >>check_ps.out
> fi
> done
>
> I have a list of processes in proc-list which want to compare with the
> ones on the system from /home/basks.tbl
>
> The problem with diff is it gives unwanted spaces in file.
>
> Thankyou

  Réponse avec citation
Vieux 24/04/2008, 16h10   #3
OldSchool
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Comparing Files

On Apr 24, 10:26am, invincible <imanuk2...@googlemail.com> wrote:
> all,
>
> Any better ideas on implementing the below....?
> .
> .
> .
> .
> .
> #Listing Missing Processes from the system>tmp1.out
>
> rsh $server cat /home/basks.tbl >>tmp1.out
> if [ -e tmp1.out ]
> then
> echo "Missing Process on system are " >>check_ps.out
> diff tmp1.out proc-list|awk '{ print $2 }' >>check_ps.out
> else
> echo "File NOT Found !!!! " >>check_ps.out
> fi
> done
>
> I have a list of processes in proc-list which want to compare with the
> ones on the system from /home/basks.tbl
>
> The problem with diff is it gives unwanted spaces in file.
>
> Thankyou


are you saying that tmp1.out contains blank lines, and that these are
being reported as differences? If so, try

sed "/^ *$/d" tmp1.out | diff - proc_list | awk.......
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 08h34.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10364 seconds with 11 queries