Comparing Files
am 24.04.2008 16:26:32 von invincible
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
Re: Comparing Files
am 24.04.2008 16:47:07 von mop2
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
Re: Comparing Files
am 24.04.2008 17:10:53 von OldSchool
On Apr 24, 10:26=A0am, 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
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.......