awk with printf

Hi,

I am using the following code to assign a count value to a variable. But I get nothing. Do you see anything wrong here.

I am new to all this.

 
$CTR=`remsh $m -l $MACHINES{$m} -n cat $output | grep -v sent | grep \"$input\" | sort -u | awk '{print $5}'`;

Upto sort - u it's working.

The phrase that is passed to awk as an Example is
"Number of repeat records: 40"

Obviously I need to retrieve the value 40. (Which is $5 for awk)

This is the last piece of my program. Any assistance is appreciated.

Thanks
nurani

Were you able to run the command manually in remote system and get result 40?

cat $output | grep -v sent | grep \"$input\" | sort -u | awk '{print $5}'

Yes... On the command line when I run the whole grep command including the awk, I get just the number.

That's what is frustrating. Thinking that a command line command would
work when I code the program.

Any suggestions

Thanks
nurani