I have two text files that have data like the example below. Using python, I want to save to a new file, the lines of the first line that are not appeared in the second file. The lines are not included in the files.
-----line----fist file ---------- second file
1 116969 116969
2 116973 116977
3 116977 117000
4 117000 117028
5 117004 117032
6 117028 117036
7 117032 117066
8 117036 117104
9 117062
10 117066
11 117097
12 117104
The new file must have this structure.
2
5
9
11
Edit: This is my code so far. The list sendfiles contains the paths to the files that have original data. The list receivefiles contains the paths to the files that have less data.
for x in range(0, len(sendfiles)):
f1 = open(sendfiles[x], 'r').readlines()
f2 = open(receivefiles[x], 'r').readlines()
path = sendfiles[x].strip('send.txt')
final_file = path + 'out.txt'
with open(final_file,'w') as f:
...
In unix, I use diff -f command but know I must write some python code to do this.
Edit2: This is and example of the send.txt and this is an example of the receive.txt