LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 12:26 PM   #1
depam
Member
 
Registered: Sep 2005
Posts: 861

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, 12:45 PM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
cmp -s /etc/hosts /etc/passwd || date
 
Old 11-24-2012, 04: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, 09:54 PM   #4
depam
Member
 
Registered: Sep 2005
Posts: 861

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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:21 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