C
C
cptedward_kenway2021-07-14 09:59:14
linux
cptedward_kenway, 2021-07-14 09:59:14

Proper use of diff?

Good afternoon friends.

There are 2 files in the first (a) file contains the entire list of data, for example:
99991111.ini
99992222.ini
99993333.ini
99994444.ini.

And in the second file (u):
99991111.ini
99993333.ini

(in fact, in the first file ~ 4k lines, in the second ~ 1.8)
I need the values ​​​​that are in file u to be removed from file a , i.e. : 9999222.ini 9999444.ini I tried diff ./a ./u > ./sw.diff , but apparently I did not fully understand how diff works and I got, of course, the wrong result. Actually a question: whether it is possible to achieve such result by means of diff'a and how?




Or if you have other suggestions - I will be very glad to hear them, thanks.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Adamos, 2021-07-14
@Adamos

comm -23 ./a ./u > ./sw.diff

Z
Zzzz9, 2021-07-14
@Zzzz9

cat a.txt
99991111.ini
99992222.ini
99993333.ini
99994444.ini
 
cat u.txt
99991111.ini
99993333.ini

diff a.txt u.txt |awk '{if(!/^</)next}{print $2}'
99992222.ini
99994444.ini

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question