Dakait
Dakait

Reputation: 2620

Difference between two files containing file names

I have two files, audit.txt and server.txt, both contain filenames. I want to get only filenames that are present in audit.txt but not in server.txt

audit.txt looks like

filename1
filename3
filename2

server.txt looks like

filename1
filename2

ideally i would want the difference in a 3rd file missing.txt that will contain filename3 as per the example above.

I have tried following but the missing.txt does not contain correct difference,

comm -13 audit.txt server.txt > missing.txt

Upvotes: 0

Views: 57

Answers (1)

Loukik
Loukik

Reputation: 161

You could use diff command like so

diff audit.txt server.txt > missing.txt

Upvotes: 1

Related Questions