Error in the o/p says bad file descriptor...

grt=`sort -nr line_count.txt|head -1`
while read $dline
do
if [ "$grt" -eq "`wc -l combo_operncount.$dline|awk '{print $1}'`" ]
then
awk -F, '{print $1}' combo_operncount.$dline > FULLD7
else
echo combo_operncount.$dline >> filecoll.txt
fname=`cat filecoll.txt|tr -s "\n" " "`
echo $fname
#paste FULLD7 combo_operncount.$dline
fi
done

[/CODE]

Error is thrown where it is highlighted

try assinging the value of the

wc -l

to a variable before going to test.

Also enclose the variable $dline inside ""

~# grt=`sort -nr filename|head -1`
~# JJ=`wc -l filename."$KK"| awk '{ print $1 }'`
~# if [ "$grt" ==  "$JJ" ]; then echo $JJ; else echo "Not true"; fi
Not true

I dint get wat u aiming to explain....

comparing two numbers should be done via

 ==

rather than

-eq

, as well. rest is for your understanding .

Wrong.
== is for string comparison and -eq is for numeric comparison.

I can't see where the while loop in your script in post #1 reads from; as is it would read from stdin which might be your terminal. Are you sure the variable dline holds a valid file name?

If you don't want wc to print a filename, don't provide one as an argument. Instead, redirect the command's standard input:

wc -l < filename

Regards,
Alister