I am trying to compare two files (Extensions.txt
and Temp.txt
). If there is a line that does not partially match from Extensions.txt
in Temp.txt
I would like to append the missing line to Temp.txt
.
Extensions.txt
(Very basic, one column):
111
1234
4321
Temp.txt
:
1234/sip:1234@192.168.1.10:5060 9421b96c5e Avail 1.480
4321/sip:4321@192.168.1.11:5060 e9b6b979a4 Avail 1.855
Basically, what I want to do is find a match based on everything before the /
in the first column and if there is no match, I would like to print the non matching line to the bottom of the file so that it would end up like this:
1234/sip:1234@192.168.1.10:5060 9421b96c5e Avail 1.480
4321/sip:4321@192.168.1.11:5060 e9b6b979a4 Avail 1.855
111
So far I have attempted grep -v
and it doesn't produce the results that I want, I also tried with awk
and it seems like that is the way to go, however I do not have a full understanding of how awk
works in order to produce the appropriate results.
1235/...
(no match in the first file) will it be in the output or not? – thanasisp Nov 15 '20 at 20:50