N
N
nak-alexey2021-11-25 19:14:02
linux
nak-alexey, 2021-11-25 19:14:02

How to compare 2 files in linux?

Hello! How to use bash to compare 2 files and show only the line that is missing in the second file?
I do diff -ui file1 ..file2 | grep строка, and the output
is + line - line
,

although the "line" is in both files, only in different places. Please help with a solution.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xotkot, 2021-11-25
@nak-alexey

show only the line that is missing in the second file

comm -23 <(sort file1.txt) <(sort file2.txt)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question