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.
Is there away for me to compare 2 files with out using c/c++ python, java, etc.. maybe only using bash/awk? see the thing is that I need to loop through 2 files and compare each user with each file to see if they are there... if not than do something with the user? Now I prefer to do this in c++ but my job doesn't want me to do this because of the limited knowledge in c++ that stands in were I work at, so... ya, now If I have no other choice than I will create it in c++.
i.e:
file one
compare it with file two
loop trough the user names on both files and see if the user name
exist on both file.
It depends on the layout of the file. If they're both just a list of user names, you could sort and use diff or sdiff to compare them. If the username is part of other data on each line, can you post a sample? Tools like cut can pull fields out of a line.
Have a look at what kompare does. It is a nice graphical diff that can give a good overall view, depending on how many modifications have been done.
Usually I use tkdiff.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.