LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-08-2023, 01:00 AM   #46
gilesaj001
Member
 
Registered: Apr 2017
Location: Australia
Distribution: Ubuntu
Posts: 79

Original Poster
Rep: Reputation: 0

After your previous post at Today 12:39 that said it was in tmp I changed that line to point to the location of CamImg.tmp2.jpg which is the image file that the data is applied to.

When I run parliament-test.sh the file is no longer created in the /tmp folder

Last edited by gilesaj001; 04-08-2023 at 01:05 AM.
 
Old 04-09-2023, 03:55 AM   #47
gilesaj001
Member
 
Registered: Apr 2017
Location: Australia
Distribution: Ubuntu
Posts: 79

Original Poster
Rep: Reputation: 0
I have an interim solution. I copied the witem program that @MadeInGermany wrote which I am using to get all the data over to a new file. In that file I changed it to read the 5th line after "Wind" which is the value of "Wind Chill".

the weather-data.txt file is like this
Code:
 Condition:
          Clear

   Pressure:
          103.3 kPa

   Tendency:
          Rising

   Temperature:
          -3.9°C

   Dew point:
          -7.2°C

   Humidity:
          78%

   Wind:
          WNW 5 km/h

   [36]Wind Chill:
          -6

   Visibility:
          24 km

   Clear

   -4°C

   Condition:
          Clear

   Pressure:
          103.3 kPa

   Tendency:
          Rising

   Temperature:
          -3.9°C

   Dew point:
          -7.2°C
The new file I created is like this

Code:
#!/bin/bash
while read line
do
 line=${line%$'\r'} # Remove a WinDOS CR
 case $line in ( "$1:" )
   read line2
   read line3
   read line4
   read line5
   line5=${line5%$'\r'}
   echo "$line5"
   break # Stop at first match
 esac
done < weather-data.txt
I also added an if statement to change windchill = $temp if windchill is greater than zero because when there is no windchill it will pick up the visibility value I think.


I would like to thank everyone that helped me on this and were patient with an 73 year old fart.

Last edited by gilesaj001; 04-09-2023 at 10:11 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy string/text manipulation/indentation for restructured text brianmcgee Linux - Software 1 04-22-2008 08:27 PM
need help with text manipulation pcorajr Programming 12 12-15-2006 07:33 AM
text manipulation in scripts manicman Linux - Newbie 8 02-17-2006 05:04 AM
Manipulation of text files in C++ Hady Programming 5 05-31-2005 08:24 AM
More text manipulation ice_hockey Linux - General 2 05-28-2005 01:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration