Compare two files and lines which are the same just delete it

I am having a two files and different days, and this is example:
file1: 06.09.2017.

abcd
123

file2: 07.09.2017.

abcd
1234

So what I want is that file2 with today's date contains only 1234, so where is a problem you would ask?
Problem is here that I put these commands into routers,. and error occurred with message that interface already exist, and no other commands are pasted into router.
Solution that I think is to compare two files, one yesterday and one for today, and compare it, if lines are the same DELETE IT FROM TODAY and leave only what is different.

If your file contents are "well-behaved", that is: contain no regexp metacharacters (somehow i don't that i have been shown the real content with "1234"), you can use grep -vf file1 file2 to filter all lines out of file2 which are also in file1 .

I hope this helps.

bakunin

i manage to succed with this command

awk 'NR==FNR{a[$0]=1;next}!a[$0]' file1 file2

and it give me the line which are only changed, but there is a some another problem...
the line which is changed is inside a interface setup.
And only THAT command when put to router does nothing, it must first go into interface
example:

/interface wireless

set [ find default-name=wlan1 ] ssid=test

so if I change only ssid, my awk command give me output

set [ find default-name=wlan1 ] ssid=test1

and that command i cant paste into router, i must and

/interface wireless

So i cant figure out how to do it.
I want to give a backup to another rotuer and if something is changed on the first one to be changed to the second, and my script does it good, but when change something like this, nothing happend, it error at first command with interface with error that interface already exist...

Please understand: this type of things is context-aware: your "set ..." means different things if it is prefaced by "/interface wireless" (then it is a command part) or not (then it is something undecipherable by tre router).

To make a program understand (and hence take into account) such differences you need to parse the input. And parsing - as a recursive process - cannot be done by regexps. Therefore your whole problem description:

is basically meaningless. In fact you need a parser which identifies not the changed lines but the changed configuration commands leading to a different setup. For this you need a language interpreter (of which the parser is one part, the lexical analyser is the other) for the routers configuration language.

I hate to break it to you but writing a parser is too big a project to do it here in a post. There are a lot of articles in the internet, though, which explain how to do it.

I hope this helps.

bakunin