ftp -n remote_server <<_FTP > $LOGFILE
quote USER username
quote PASS password
prompt noprompt
pwd
!echo "MARKED START\n"
ls -ltr
!echo "\nMARKED END"
get s1.txt
bye
_FTP
Note, you may need to use !print .... to get the new-line, depending on your OS.
You then will have a section of the output you can retrieve between the marked start & end. If you have the -p flag on grep, this becomes relatively trivial:-
egrep -vp "MARKED START|MARKED END" $LOGFILE
The -p flag matches a paragraph, so all the output up to the blank line after the "MARKED START" and all the text after the blank before the "MARKED END" will be excluded by the grep -v