<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>ansiweather &amp;mdash; Paul Sutton</title>
    <link>https://personaljournal.ca/paulsutton/tag:ansiweather</link>
    <description>Personal Blog</description>
    <pubDate>Tue, 05 May 2026 18:22:54 +0000</pubDate>
    <item>
      <title>Ansi Weather 2</title>
      <link>https://personaljournal.ca/paulsutton/ansi-weather-2</link>
      <description>&lt;![CDATA[Ansi Weather 2&#xA;&#xA;img src=&#34;https://socialhub.activitypub.rocks/uploads/default/original/1X/6aac842b7ff5c58385a02f3a131c259281be88c8.png&#34; target=&#34;_blank&#34; &#xA;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xA;&#xA;Further to my previous post on ansi weather &#xA;&#xA;I wrote this, which asks for your location, and displays the weather.&#xA;&#xA;echo &#34;where do you live ?&#34;&#xA;read location&#xA;ansiweather -l $location&#xA;&#xA;In my previous post I was trying to use sed to clean up the output,  this isn&#39;t needed as the -a option removes the colour coding from the output&#xA;&#xA;ansiweather -a false -l Plymouth, UK     weatherinfo.txt&#xA;&#xA;Produces&#xA;&#xA;Weather in Plymouth =  -10 °C - Wind =  1.72 m/s NNW - Humidity =  62 % - Pressure =  1028 hPa &#xA;&#xA;Which is far better. &#xA;&#xA;so our new shell script is &#xA;&#xA;1 #send weather info to Mastodon&#xA;  2 # current date&#xA;  3 date   weatherinfo.txt&#xA;  4 # current weather&#xA;  5 # use -a false to remove colour from output, set location, output to a file&#xA;  6 ansiweather -a false -l Plymouth, UK     weatherinfo.txt&#xA;  7 # output to console too&#xA;  8 ansiweather -a false -l Plymouth, UK&#xA;  9 #send to Mastodon&#xA; 10 toot post &lt; weatherinfo.txt&#xA; 11 # done&#xA; 12 echo done&#xA;&#xA;So the final output to Mastodon is&#xA;&#xA;Final Output&#xA;&#xA;There are more options in the READ.me file&#xA;&#xA;Thank you to Noisytoot for helping with this. &#xA;&#xA;If you now combine the 2nd script with the one I have at the top of this page you should be able to input your location, then get the local weather. &#xA;&#xA;REFERENCES&#xA;&#xA;READ.me file&#xA;man ansiweather - for the man page&#xA;Free Software Foundation&#xA;&#xA;TAGS&#xA;&#xA;#YearOfTheFediverse,#ansiweather,#weather,#mastodon,#bash,#console,#terminal&#xA;information&#xA;&#xA;a rel=&#34;license&#34; href=&#34;http://creativecommons.org/licenses/by-sa/4.0/&#34;img alt=&#34;Creative Commons Licence&#34; style=&#34;border-width:0&#34; src=&#34;https://i.creativecommons.org/l/by-sa/4.0/88x31.png&#34; //abr /This work is licensed under a a rel=&#34;license&#34; href=&#34;http://creativecommons.org/licenses/by-sa/4.0/&#34;Creative Commons Attribution-ShareAlike 4.0 International License/a&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Ansi Weather 2</p>

<p><a href="https://torresjrjr.com/archive/2020-07-19-guide-to-the-fediverse" rel="nofollow"><img src="https://socialhub.activitypub.rocks/uploads/default/original/1X/6aac842b7ff5c58385a02f3a131c259281be88c8.png"></a></p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>

<p>Further to my <a href="https://personaljournal.ca/paulsutton/ansi-weather" rel="nofollow">previous post on ansi weather</a></p>

<p>I wrote this, which asks for your location, and displays the weather.</p>

<pre><code>echo &#34;where do you live ?&#34;
read location
ansiweather -l $location
</code></pre>

<p>In my previous post I was trying to use sed to clean up the output,  this isn&#39;t needed as the -a option removes the colour coding from the output</p>

<p>ansiweather -a false -l Plymouth, UK &gt;&gt; weatherinfo.txt</p>

<p>Produces</p>

<p>Weather in Plymouth =&gt; -10 °C – Wind =&gt; 1.72 m/s NNW – Humidity =&gt; 62 % – Pressure =&gt; 1028 hPa</p>

<p>Which is far better.</p>

<p>so our new shell script is</p>

<pre><code>1 #send weather info to Mastodon
  2 # current date
  3 date &gt; weatherinfo.txt
  4 # current weather
  5 # use -a false to remove colour from output, set location, output to a file
  6 ansiweather -a false -l Plymouth, UK &gt;&gt; weatherinfo.txt
  7 # output to console too
  8 ansiweather -a false -l Plymouth, UK
  9 #send to Mastodon
 10 toot post &lt; weatherinfo.txt
 11 # done
 12 echo done

</code></pre>

<p>So the final output to Mastodon is</p>

<p><img src="https://git.qoto.org/zleap/documents/-/raw/master/weatherinfooutput.png" alt="Final Output"></p>

<p>There are more options in the <a href="https://github.com/fcambus/ansiweather" rel="nofollow">READ.me file</a></p>

<p>Thank you to Noisytoot for helping with this.</p>

<p>If you now combine the 2nd script with the one I have at the top of this page you should be able to input your location, then get the local weather.</p>

<p><strong>REFERENCES</strong></p>
<ul><li><a href="https://github.com/fcambus/ansiweather" rel="nofollow">READ.me file</a></li>
<li>man ansiweather – for the man page</li>
<li><a href="https://www.fsf.org" rel="nofollow">Free Software Foundation</a></li></ul>

<p><strong>TAGS</strong></p>

<p><a href="/paulsutton/tag:YearOfTheFediverse" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">YearOfTheFediverse</span></a>,<a href="/paulsutton/tag:ansiweather" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ansiweather</span></a>,<a href="/paulsutton/tag:weather" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">weather</span></a>,<a href="/paulsutton/tag:mastodon" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">mastodon</span></a>,<a href="/paulsutton/tag:bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">bash</span></a>,<a href="/paulsutton/tag:console" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">console</span></a>,<a href="/paulsutton/tag:terminal" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">terminal</span></a>
<a href="/paulsutton/tag:information" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">information</span></a></p>

<p><a href="http://creativecommons.org/licenses/by-sa/4.0/" rel="nofollow"><img alt="Creative Commons Licence" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png"/></a><br/>This work is licensed under a <a href="http://creativecommons.org/licenses/by-sa/4.0/" rel="nofollow">Creative Commons Attribution-ShareAlike 4.0 International License</a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/ansi-weather-2</guid>
      <pubDate>Fri, 05 Feb 2021 07:30:00 +0000</pubDate>
    </item>
    <item>
      <title>Ansi Weather</title>
      <link>https://personaljournal.ca/paulsutton/ansi-weather</link>
      <description>&lt;![CDATA[Ansi Weather&#xA;&#xA;img src=&#34;https://socialhub.activitypub.rocks/uploads/default/original/1X/6aac842b7ff5c58385a02f3a131c259281be88c8.png&#34; target=&#34;_blank&#34; &#xA;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xA;&#xA;Getting weather information is really useful. What happens if you&#39;re at the command line in Linux?  I found a really little application that can help&#xA;&#xA;ansiweather &#xA;&#xA;apt install ansiweather&#xA;&#xA;ansiweather -l Plymouth, UK&#xA;&#xA;Ansi Weather Output&#xA;&#xA;So what else can we do with this&#xA;&#xA;Send the output to Mastodon with toot post&#xA;&#xA;This is a two step process&#xA;&#xA;ansiweather -l Plymouth, UK   weather.txt&#xA;toot post &lt; weather.txt&#xA;&#xA;Will send the weather info to Mastodon.&#xA;&#xA;However this does not include any date info&#xA;&#xA;We can fix this with&#xA;&#xA;date   weatherinfo.txt&#xA;ansiweather -l Plymouth, UK     weatherinfo.txt&#xA;&#xA;then send the whole lot to Mastodon with&#xA;&#xA;toot post &lt; weatherinfo.txt&#xA;&#xA;So, if we put this in to a final shell script we need:- &#xA;&#xA;send weather info to Mastodon&#xA;current date&#xA;date   weatherinfo.txt&#xA;current weather&#xA;ansiweather -l Plymouth, UK     weatherinfo.txt&#xA;send to Mastodon&#xA;toot post &lt; weatherinfo.txt&#xA;done&#xA;echo done&#xA;&#xA;Again released under GPLv3&#xA;&#xA;I tried to get festival to speak the weather, it is not perfect but this sort of works,  you will need to direct to weather.txt first.  &#xA;&#xA;festival --tts &lt; weather.txt&#xA; &#xA;Looking in to this further, the issue is the brackets etc, so this stackoverflow post&#xA;&#xA;strips out the colour formatting&#xA;&#xA;sed &#39;s/\x1b\[m//g&#39; weatherinfo.txt&#xA;&#xA;Therefore &#xA;&#xA;sed &#39;s/\x1b\[m//g&#39; weatherinfo.txt   weatherinfo2.txt&#xA;&#xA;Sends the newly formatted text to weatherinfo2.txt&#xA;&#xA;So running back through festival&#xA;&#xA;festival --tts &lt; weather.txt&#xA;&#xA;Is perhaps a little better, but not perfect&#xA;&#xA;So going back to what we wrote earlier to send to Mastodon, the new script &#xA;&#xA;  1 #send weather info to Mastodon&#xA;  2 # current date&#xA;  3 date   weatherinfo.txt&#xA;  4 # current weather&#xA;  5 ansiweather -l Plymouth, UK     weatherinfo.txt&#xA;  6 # clean up output with sed&#xA;  7 sed &#39;s/\x1b\[*m//g&#39; weatherinfo.txt   weatherinfo2.txt&#xA;  8 #send to Mastodon&#xA;  9 toot post &lt; weatherinfo2.txt&#xA; 10 # done&#xA; 11 echo done&#xA;&#xA;Produces much nicer output. The top bottom part of this illustrates what was sent before we stripped out the colour formatting&#xA;&#xA;However it still isn&#39;t perfect, as it removes part some of the wording, but it is hopefully getting there.  &#xA;&#xA;Weather Output (new)&#xA;&#xA;REFERENCES&#xA;&#xA;Ansi Weather&#xA;Free Software Foundation&#xA;&#xA;TAGS&#xA;&#xA;#YearOfTheFediverse,#Weather,#Scripting,#Bash,#Linux,&#xA;#Mastodon,#ProblemSolving,#AnsiWeather,#programming,&#xA;#Stackoverflow,#sed,#cat,#grep,GPL3,#FSF&#xA;&#xA;a rel=&#34;license&#34; href=&#34;http://creativecommons.org/licenses/by-sa/4.0/&#34;img alt=&#34;Creative Commons Licence&#34; style=&#34;border-width:0&#34; src=&#34;https://i.creativecommons.org/l/by-sa/4.0/88x31.png&#34; //abr /This work is licensed under a a rel=&#34;license&#34; href=&#34;http://creativecommons.org/licenses/by-sa/4.0/&#34;Creative Commons Attribution-ShareAlike 4.0 International License/a&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Ansi Weather</p>

<p><a href="https://torresjrjr.com/archive/2020-07-19-guide-to-the-fediverse" rel="nofollow"><img src="https://socialhub.activitypub.rocks/uploads/default/original/1X/6aac842b7ff5c58385a02f3a131c259281be88c8.png"></a></p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>

<p>Getting weather information is really useful. What happens if you&#39;re at the command line in Linux?  I found a really little application that can help</p>

<p>ansiweather</p>

<p>apt install ansiweather</p>

<p>ansiweather -l Plymouth, UK</p>

<p><img src="https://git.qoto.org/zleap/documents/-/raw/master/ansiweather.png" alt="Ansi Weather Output"></p>

<p>So what else can we do with this</p>
<ol><li>Send the output to Mastodon with toot post</li></ol>

<p>This is a two step process</p>
<ol><li>ansiweather -l Plymouth, UK &gt; weather.txt</li>
<li>toot post &lt; weather.txt</li></ol>

<p>Will send the weather info to Mastodon.</p>

<p>However this does not include any date info</p>

<p>We can fix this with</p>
<ol><li>date &gt; weatherinfo.txt</li>
<li>ansiweather -l Plymouth, UK &gt;&gt; weatherinfo.txt</li></ol>

<p>then send the whole lot to Mastodon with</p>
<ol><li>toot post &lt; weatherinfo.txt</li></ol>

<p>So, if we put this in to a final shell script we need:-</p>

<pre><code>#send weather info to Mastodon
# current date
date &gt; weatherinfo.txt
# current weather
ansiweather -l Plymouth, UK &gt;&gt; weatherinfo.txt
#send to Mastodon
toot post &lt; weatherinfo.txt
# done
echo done

</code></pre>

<p>Again released under <a href="https://www.gnu.org" rel="nofollow">GPLv3</a></p>

<p>I tried to get festival to speak the weather, it is not perfect but this sort of works,  you will need to direct to weather.txt first.</p>

<p>festival —tts &lt; weather.txt</p>

<p>Looking in to this further, the issue is the brackets etc, so this <a href="https://stackoverflow.com/questions/36547654/remove-colour-code-from-linux-files" rel="nofollow">stackoverflow post</a></p>

<p>strips out the colour formatting</p>

<p>sed &#39;s/\x1b[[^\x1b]*m//g&#39; weatherinfo.txt</p>

<p>Therefore</p>

<p>sed &#39;s/\x1b[[^\x1b]*m//g&#39; weatherinfo.txt &gt; weatherinfo2.txt</p>

<p>Sends the newly formatted text to weatherinfo2.txt</p>

<p>So running back through festival</p>

<p>festival —tts &lt; weather.txt</p>

<p>Is perhaps a little better, but not perfect</p>

<p>So going back to what we wrote earlier to send to Mastodon, the new script</p>

<pre><code>  1 #send weather info to Mastodon
  2 # current date
  3 date &gt; weatherinfo.txt
  4 # current weather
  5 ansiweather -l Plymouth, UK &gt;&gt; weatherinfo.txt
  6 # clean up output with sed
  7 sed &#39;s/\x1b\[[^\x1b]*m//g&#39; weatherinfo.txt &gt; weatherinfo2.txt
  8 #send to Mastodon
  9 toot post &lt; weatherinfo2.txt
 10 # done
 11 echo done

</code></pre>

<p>Produces much nicer output. The top bottom part of this illustrates what was sent before we stripped out the colour formatting</p>

<p>However it still isn&#39;t perfect, as it removes part some of the wording, but it is hopefully getting there.</p>

<p><img src="https://git.qoto.org/zleap/documents/-/raw/master/weatheroutput.png" alt="Weather Output (new)"></p>

<p><strong>REFERENCES</strong></p>
<ul><li><a href="https://www.maketecheasier.com/check-weather-from-terminal-with-ansiweather/" rel="nofollow">Ansi Weather</a></li>
<li><a href="https://www.fsf.org" rel="nofollow">Free Software Foundation</a></li></ul>

<p><strong>TAGS</strong></p>

<p><a href="/paulsutton/tag:YearOfTheFediverse" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">YearOfTheFediverse</span></a>,<a href="/paulsutton/tag:Weather" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Weather</span></a>,<a href="/paulsutton/tag:Scripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Scripting</span></a>,<a href="/paulsutton/tag:Bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bash</span></a>,<a href="/paulsutton/tag:Linux" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Linux</span></a>,
<a href="/paulsutton/tag:Mastodon" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Mastodon</span></a>,<a href="/paulsutton/tag:ProblemSolving" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ProblemSolving</span></a>,<a href="/paulsutton/tag:AnsiWeather" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">AnsiWeather</span></a>,<a href="/paulsutton/tag:programming" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">programming</span></a>,
<a href="/paulsutton/tag:Stackoverflow" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Stackoverflow</span></a>,<a href="/paulsutton/tag:sed" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">sed</span></a>,<a href="/paulsutton/tag:cat" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">cat</span></a>,<a href="/paulsutton/tag:grep" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">grep</span></a>,GPL3,<a href="/paulsutton/tag:FSF" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">FSF</span></a></p>

<p><a href="http://creativecommons.org/licenses/by-sa/4.0/" rel="nofollow"><img alt="Creative Commons Licence" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png"/></a><br/>This work is licensed under a <a href="http://creativecommons.org/licenses/by-sa/4.0/" rel="nofollow">Creative Commons Attribution-ShareAlike 4.0 International License</a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/ansi-weather</guid>
      <pubDate>Sat, 30 Jan 2021 22:42:42 +0000</pubDate>
    </item>
  </channel>
</rss>