LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-24-2012, 01:26 PM   #1
depam
Member
 
Registered: Sep 2005
Posts: 847

Rep: Reputation: 30
Script to check for text file is different and perform certain action


Need help from script guru to compare two files and if there's any difference perform specific action.
 
Old 11-24-2012, 01:45 PM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 979
Blog Entries: 2

Rep: Reputation: 235Reputation: 235Reputation: 235
cmp -s /etc/hosts /etc/passwd || date
 
Old 11-24-2012, 05:42 PM   #3
archShade
Member
 
Registered: Mar 2006
Location: Delft NL
Distribution: Debian; Slackware; windows 7
Posts: 218

Rep: Reputation: 53
Diff is a good tool for comparing files as to how to trigger an event on the output I think some more details of your problem or maybe an analogous example?
 
Old 11-26-2012, 10:54 PM   #4
depam
Member
 
Registered: Sep 2005
Posts: 847

Original Poster
Rep: Reputation: 30
I setup an SMS gateway which is accessible via browser. I used curl to do this.

#curl -u userass http://someurl.html >> /tmp/somefile.txt

The file is on html format and I need to grep where the SMS messages is so I did

#cat /tmp/somefile.txt | grep -i "var sms"

The output example file as below:


var sms= ["11-27 08:34:28,SENDER,MESSAGE1","11-27 05:25:58,SENDER,MESSAGE2","11-27 05:25:58,SENDER,MESSAGE3"];

and so on and so forth.

What I want to do is to get output of this html and trim these SMS messages. Maybe a crontab every 10 or 15 minutes that will get the output via curl compare the previous file and if there is any change, send the output to an email. I would also need to parse the above value correctly so it will be easier to read in the email. Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
You are not authorized to perform this action RockyRX Linux - Newbie 9 07-22-2010 10:50 PM
Isolate lines in a text file and perform replacements neville310 Programming 3 06-19-2007 10:20 AM
Perform action based on email txt plisken Linux - General 1 03-06-2007 10:49 PM
How to perform a file system check? atheist Linux - General 6 02-29-2004 12:47 PM
GUI test tool to perform widget functions via a text file liguorir Linux - Software 0 01-05-2004 03:30 PM


All times are GMT -5. The time now is 12:31 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration