Basically, I had a file, which contained around 90 usernames.
I had to delete all of those usernames from the passwd file, which was a total of 300 lines long.
I tried to come up with a way to at least filter the duplicate usernames and print out the ones, which have to remain but had no sucess.
Let's say that the file, where I had the 90 usernames for removal contains:
file.txt
user1
user2
user3
user4
The passwd file contains these usernames, along with a lot more
passwd
user31
user32
user1
user23
user2
user4
user15
user3
The usernames inside the passwd file were randomly spread inside the file, so diff -y
wouldn't have done the job.
My goal here was to compare the two file, for example cat the file.txt and use the output to search inside the passwd. The result should be either a removal of the duplicate lines, or a printing of the unique lines.