Message Area
Casually read the BBS message area using an easy to use interface. Messages are categorized exactly like they are on the BBS. You may post new messages or reply to existing messages!

You are not logged in. Login here for full access privileges.

Previous Message | Next Message | Back to BBS Software Chatter  <--  <--- Return to Home Page
   Networked Database  BBS Software Chatter   [519 / 864] RSS
 From   To   Subject   Date/Time 
Message   Sean Dennis    Phil Kimble   A new project   May 7, 2018
 6: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)
  Show ANSI Codes | Hide BBCodes | Show Color Codes | Hide Encoding | Hide HTML Tags | Show Routing
Previous Message | Next Message | Back to BBS Software Chatter  <--  <--- Return to Home Page

VADV-PHP
Execution Time: 0.0793 seconds

If you experience any problems with this website or need help, contact the webmaster.
VADV-PHP Copyright © 2002-2024 Steve Winn, Aspect Technologies. All Rights Reserved.
Virtual Advanced Copyright © 1995-1997 Roland De Graaf.
v2.0.140505

Warning: Unknown: open(c:\Sessions\sess_99mand1v6umfqkael43fnhh0u4, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (c:\Sessions) in Unknown on line 0 PHP Warning: session_start(): open(c:\Sessions\sess_99mand1v6umfqkael43fnhh0u4, O_RDWR) failed: No such file or directory (2) in D:\wc5\http\public\VADV\include\common.inc.php on line 45 PHP Warning: Unknown: open(c:\Sessions\sess_99mand1v6umfqkael43fnhh0u4, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (c:\Sessions) in Unknown on line 0