What some ideas with sort and get unique data

Hi all,

I am writing a script where i can parse through the directory and get common string in two directories i get. The command below SUN_PLATFORM=`$FIND $STREAM_PATH . -depth -name ShareableEntities | $AWK -F"/" '{if($10 ~ /sun5/) print $0}'` gives the following output:-

/net/icebox/vol/local_images/spins/7.1/CQ/7.1.D081110/sun5/ShareableEntities
/net/icebox/vol/local_images/spins/7.1/CC/7.1.D081110/sun5/ShareableEntities

So in next i go store the result in SUN_PLATFORM and do a for loop where i grep file that have .su extension and do a delimiter in awk to print the 1st line. Now i want a way that i can sort the output and get the uniq count(uniq -c) from the two directories. I dont want to write the output the other file and they apply sort and uniq.

If i add to the line in the code below $LS $i | $GREP .su | $AWK -F"_" '{print $1}'| sort | uniq -c . This wont work as it sorts the data in one only one directory and then separately in other directory. The result is not appropriate.

Please suggest.

Thanks
Adsi

#!/bin/sh

ECHO=/bin/echo
FIND=/bin/find
AWK=/bin/awk
LS=/bin/ls
GREP=/bin/grep

ROOT_PATH=/net/icebox/vol/local_images/spins
STREAM_PATH=$ROOT_PATH/7.1

SUN_PLATFORM=`$FIND $STREAM_PATH . -depth -name ShareableEntities | $AWK -F"/" '{if($10 ~ /sun5/) print $0}'`

for i in $SUN_PLATFORM
do
$ECHO $i
$LS $i | $GREP .su | $AWK -F"_" '{print $1}'
done

something like this?

#!/bin/sh

ECHO=/bin/echo
FIND=/bin/find
AWK=/bin/awk
LS=/bin/ls
GREP=/bin/grep

ROOT_PATH=/net/icebox/vol/local_images/spins
STREAM_PATH=$ROOT_PATH/7.1

SUN_PLATFORM=`$FIND $STREAM_PATH . -depth -name ShareableEntities | $AWK -F"/" '{if($10 ~ /sun5/) print $0}'`

for i in $SUN_PLATFORM
do
$ECHO $i
$LS $i | $GREP .su | $AWK -F"_" '{print $1}'
done | sort | uniq -c