I've borrowed and written the following code to output the disconnect time. All works well but I'm curious as to how I could tighten/ shorten the code. If anyone feels like having some fun then I'd love to see what can be done. Be a learning lesson for me.
Output:
ftp> !:--- FTP commands below here ---
ftp> lcd C:\Utilities\Performance_Testing\
\Utilities\Performance_Testing\: File not found
Verbose mode On .
ftp> verbose
binary
200 Switching to Binary mode.
ftp> put "test_file_5M.bin"
200 PORT command successful.
150 Ok to send data.
226 File receive OK.
ftp: 5242880 bytes sent in Seconds Kbytes/sec.
ftp> 44.81117.00disconnect
221 Goodbye.
ftp> bye
Code:
#Obtain UT external put value.
ut1intput=$(awk '
NR==70 {
for(i=1;i<=NF;i++) {
if($i=="ftp>") {
sub(/disconnect/, "", $(i+1));
print $(i+1)
}
}
}' filename.txt)
utintputvalue=`echo $ut1intput | awk -F. '{print $2"."$3}'| sed 's/^..//'`
Output:
UT external put value is 1220.98