Subj : A new project To : Phil Kimble From : Sean Dennis Date : Mon May 07 2018 06:33 pm Hello Phil, 07 May 18 12:42 at you wrote to me: PK> sed is the one tool/utility that has dodged me for years. Never a PK> first time go with it. If you can wrestle it & come out on the good PK> side, you are doing much better than I. Nothing that Google couldn't help me solve. What was the trick is using the "-i" or "--in-place" switch with sed. So here's the bash script that does the dirty work. The expect script is called and then sed does some of the work here. For some reason, I screwed up and in the expect script, I cut off the last few lines of the output and that's something I will fix soon and release a fix. === Cut === #!/bin/bash cd /opt/mbse/bin ## It's a "noisy" script so send any output to /dev/null expect weather.expect > /dev/null 2>&1 ## Trim off the first and last lines sed -i '1d;$d' weather.txt ## Add a blank line to the top sed -i '1i \\n' weather.txt ## Add a blank line at the bottom sed -i '$a \\n' weather.txt ## Dump the extra prompt in the text file sed -i '/ Press Return to continue, M to return to menu, X to exit: /d' weather.txt ## Get rid of the control codes (^M) cat weather.txt | col -b > weather.asc ## Put the textfile in my BBS' textfiles directory rm --force /opt/mbse/share/int/txtfiles/en/weather.asc mv weather.asc /opt/mbse/share/int/txtfiles/en/weather.asc rm weather*.txt === Cut === Here's the expect script: === Cut === spawn telnet rainmaker.wunderground.com expect "Press Return to continue:" send "\r" expect "or enter 3 letter forecast city code-- " send "TRI\r" log_file "weather.txt" expect "Press Return to continue, M to return to menu, X to exit: " send "\r" log_file expect "Selection:" send "x\r" expect eof === Cut === Later, Sean .... Nothing is free. Even age. Age is the fee God charges for life. --- GoldED+/LNX 1.1.5-b20170303 * Origin: Outpost BBS * Limestone, TN, USA (1:18/200) .