Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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'm sure there will be but it will involve some scripting, like in the following thread I found, which has a Python and Awk example. Is there a special reason why you don't want to install a tool but prefer writing a script? Besides the obvious reason of learning?
Distribution: debian on servers, ubuntu on desktops/laptops
Posts: 45
Rep:
This is probably goofy, but you could put every word on it's own line:
Code:
$ cat file1
Hi, My name is John smith
$ cat file2
Hi, My name is smith
$ sed 's/ /\n/g' file1 > file1.tmp
$ sed 's/ /\n/g' file2 > file2.tmp
$ comm -3 file1.tmp file2.tmp
John
$ sort file1.tmp file2.tmp | uniq -u
John
i want to include this code in a shell script that will be use in a different machines, it's better to make it run with the basic linux shell commands.
thanks akelder, this what i was looking for, i pipe the commands and it work fine:
Quote:
$ cat file1 file2 | sed 's/ /\n/g' | sort | uniq -u
john
Last edited by Dr_Death_UAE; 02-23-2011 at 05:20 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.