commands to remote sftp

Hello,
Is there a way to use wc, sed or other commands against remote sftp in a regular shell script?

wc -c *.* | grep total | sed s/total// ?

thanks in advance