ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I need to create a script where if there are new alias created, it will dump to a file. I use diff. rsync the alias file every 5 mins and compare the new one to the old one.
However, if there are remove aliases, it still dump to a file. That is the problem. Can diff recognize the new text and removed text? Or do I need to use other language? I tried a create script as simple as possible that's why I'm using shell.
I need to dump to a text file all new alias. alias is referring to email aliases. For me to do that, I get a copy of aliases file every 10 mins. and rename it aliases.1. Then, I got a copy again of aliases and rename it aliases.2 every 5 mins. Example:
Get aliases around 10:00AM and rename aliases.1
Get aliases around 10:05AM and rename aliases.2
Then run "diff aliases.1 aliases.2 > text_file" at 10:07AM
This way, all new/added aliases from 10:00 to 10:05.
However, if you remove some of the line in aliases, it's still recognize in the diff the email address that you remove. That's my problem. I don't want diff to output any remove lines. All I want to output is the new email address added in aliases file
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.