The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 03-24-2008
summer_cherry summer_cherry is online now
Registered User
 

Join Date: Jun 2007
Location: Beijing China
Posts: 563
Hi,

Try follow one, it should be ok for you!

Code:
sed -n '/^name/p' a | awk '{print $2}' | sort > a.t
sed -n '/^name/p' b | awk '{print $2}' | sort > b.t
for i in `comm -23 a.t b.t`
do
echo "$i" is in a but not in b
done
echo
for i in `comm -13 a.t b.t`
do
echo "$i" is in b but not in a
done
rm a.t b.t
Reply With Quote