hi there.
I'm at SunOS 5.9
At my new job i'm using UNIX, and it's my first time.
i'm trying to make a script for:
-find files with a name passed to it as parameter
-compare results with file size passed as parameter too
-when comparison's true --> move file
-if not--> make nothing
well, i'll have prevent too similer name-size files. but i can solve that later.
my trouble now is in spliting string with awk. i can't understand why it doesn't
work
name=`find $CLL_DAT -name "$1*" -print`;
lines=`awk 'END { print NR }' $name`
echo "$lines";
if [ "$lines" = "$2" ];
then
echo "here i'll do what i have";
else
echo "ERROR $name";
fi
this is working, but i need to expand string catched by find, into 'n' strings,
and make things for all of them.
name=`find $CLL_DAT -name "$1*" -print`;
awk '{n=split($name,names," ")}'#########################i don't know how to make work this split function
flag=0
for (( i = 0 ; i <= n; i++ ))
do
lines=`awk '{END { print NR }}' ${names[$i]}`
echo "$lines"
if [ "$lines" = "$2" ];
then
if ["$flag" = 1];
then
echo 'two files matches'
exit
fi
flag=1
name=$\{names[$i]\}
echo 'matches'
else
echo "don't matches"
fi
done
