01-27-2011
Comparing a number in a text file with a specific value
My project is to get a temperature reading from a refridgerator every 2 minutes and check to see if the door has been left open.
I don't yet have the mastery of Linux, being a complete noob, but I reckon I need a text file with the latest temperature reading in it. This I've managed to do by getting cron to call up a script called fridgedoor every 2 minutes and outputting the result from Digitemp (serial temperature reader) to fridgedoor.txt.
So every 2 minutes fridgedoor.txt is overwritten with the current temperature. The file just has a number in it e.g "3.06"
So I've got line 1 of my script done and dusted.
My next job is to get it to play a .wav if the temperature is greater than 5.00
Aaaah! My knowledge of commands was pretty well used up on line 1.
I know I start with if and end with fi. It's just the teensy weensy bits in the middle I'm clueless about.
Anybody want to help a knackered old sop like me out with the middle bit?
I await in eager anticipation...
Happy New Year by the way...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I wanted to add specific text to each row in a text file containing three rows. Example:
0 8 7 6 5 5
7 8 9 0 7 9
7 8 9 0 1 2
And I want to add a 21 at the beginning of the first row, and blank spaces at the beginning of the second two rows. To get this:
21 0 8 7 6 5 5
7 8... (4 Replies)
Discussion started by: hertingm
4 Replies
2. Shell Programming and Scripting
Hi
I want to extract certain text between two line numbers like
23234234324 and
54446655567567
How do I do this with a simple sed or awk command?
Thank you.
---------- Post updated at 06:16 PM ---------- Previous update was at 05:55 PM ----------
found it:
sed -n '#1,#2p'... (1 Reply)
Discussion started by: return_user
1 Replies
3. Shell Programming and Scripting
I am attempting to insert multiple lines of text into a specific place in a text file based on the lines above or below it.
For example, Here is a portion of a zone file.
IN NS ns1.domain.tld.
IN NS ns2.domain.tld.
IN ... (2 Replies)
Discussion started by: cdn_humbucker
2 Replies
4. Shell Programming and Scripting
Hi,
I have the following text file:
8 T1mapping_flip02 ok 128 108 30 1 665000-000008-000001.dcm
9 T1mapping_flip05 ok 128 108 30 1 665000-000009-000001.dcm
10 T1mapping_flip10 ok 128 108 30 1 665000-000010-000001.dcm
11 T1mapping_flip15 ok 128 108 30... (2 Replies)
Discussion started by: goodbenito
2 Replies
5. Linux
Hello! All,
Could you please tell me how to get a specific line number from a text file?
For example below,
ABC
DEF ---> Get this line number, return to an variable
GHI
My OS is Linux.
Thank you so much for your help in advance! (3 Replies)
Discussion started by: barryxian
3 Replies
6. Shell Programming and Scripting
hi,
I need a script which can format the below text file which contains comments
file1.txt
--------
//START
//Name: some value
//Date:
//Changes:.............
//.....................
//END
//START
//Date:
//Name: some value
//Changes:.............
//..................... (3 Replies)
Discussion started by: flamingo_l
3 Replies
7. UNIX Desktop Questions & Answers
Hi, Good day.
I currently have this data called database.txt and I would like to check if there are no similar values (all unique) on an entire row considering the whole column data is unique. the data is as follows
cL1 cL2 cL3 cL4
a12 c13 b13 c15
b11 a15 c19 b11
c15 c17 b13 f14
with... (1 Reply)
Discussion started by: whitecross
1 Replies
8. UNIX for Dummies Questions & Answers
I have this space delimited large text file with more than 1,000,000+ columns and about 100 rows. I want to delete all the cells that consist of just 2 (leave 2's that are not by themselves intact):
File before modification
aa bb cc 2 NA100 dd
aa b1 c2 2 NA102 de
File after modification... (1 Reply)
Discussion started by: evelibertine
1 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I have a value stored in x and I need to compare it to the numbers in every other line of a file. The file contains alternating lines of numbers and letters:
aaaa1111
AAAAAAAA
bbbb2222
BBBBBBBB
cccc3333
CCCCCCCC
I need to compare x to the numbers in every other line without the... (2 Replies)
Discussion started by: ShiGua
2 Replies
10. Shell Programming and Scripting
Hi
This is my first post and I'm just a beginner. So please be nice to me.
I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file?
I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies
LEARN ABOUT XFREE86
door_revoke
door_revoke(3DOOR) Door Library Functions door_revoke(3DOOR)
NAME
door_revoke - revoke access to a door descriptor
SYNOPSIS
cc -mt [ flag ... ] file ... -ldoor [ library ... ]
#include <door.h>
int door_revoke(int d);
DESCRIPTION
The door_revoke() function revokes access to a door descriptor. Door descriptors are created with door_create(3DOOR). The door_revoke()
function performs an implicit call to close(2), marking the door descriptor d as invalid.
A door descriptor can only be revoked by the process that created it. Door invocations that are in progress during a door_revoke() invoca-
tion are allowed to complete normally.
RETURN VALUES
Upon successful completion, door_revoke() returns 0. Otherwise, door_revoke() returns -1 and sets errno to indicate the error.
ERRORS
The door_revoke() function will fail if:
EBADF An invalid door descriptor was passed.
EPERM The door descriptor was not created by this process (with door_create(3DOOR)).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Architecture |all |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO
close(2), door_create(3DOOR), libdoor(3LIB), attributes(5)
SunOS 5.10 21 Aug 1997 door_revoke(3DOOR)