You can easily do that with sed substitute:
sed is the program, s stands for substitute, /foo/ is the search query and bar/ its replacement. Example:
Code:
sed 's/TempIn /insideTemp=/g'
Will substitute TempIn with insideTemp=. Notice the space after TempIn to substitute that as well.
Are you going to store or just display this info? Sed does this "on the fly" more or less (not humanly visible).
For a file testfile do:
Code:
cat testfile | sed 's/TempIn /insideTemp=/g'
to output the new line "live".
Otherwise you'll need 2 files: inputfile and outputfile
Code:
#!/bin/bash
inputfile="/path/to/inputfile"
outputfile="/path/to/outputfile"
# in case output file does not exist
touch -a $outputfile
cat testfile | sed 's/TempIn /insideTemp=/g' >> $outputfile
Repeat for each line. The double >> just appends and does not replace text. If you want to use 2 files and display the latter, you'll need to empty or just delete the outputfile on consecutive runs;
Code:
#!/bin/bash
inputfile="/path/to/inputfile"
outputfile="/path/to/outputfile"
# if outputfile exists delete it, else touch/create it
if [ -f $outputfile ] ; then
rm $outputfile
else
touch -a $outputfile
fi
# substitutions:
cat testfile | sed 's/TempIn /insideTemp=/g' >> $outputfile
# fill in the rest above, then
exit
Then you'll need to save this as something.sh, chmod +x something.sh to make it executable (like a program), and then ask cron to run this at your desired interval.