2 of 3 edited title

How can I compare two files line by line?

I have two files A and B which are almost same with some lines different and with some lines jumbled. Since the two files are systemverilog files the lines also contain special characters like ; , = + etc I want to loop through each line of file A and check if there is a corresponding match in file B. The comparison should follow the rules

  1. Space at the beginning and end of the line can be ignored.
  2. Multiple space/tab between words can be considered as single space.
  3. Empty lines can be ignored

The result should display the lines that are present in file A but not in file B.

I need a script(either python or perl or shell or anything else ) that can run on most linux machines without requiring to install some packages.

I tried tkdiff but since some lines are jumbled it shows many differences

The lines that are present in B but not in A is also of interest but that I can get by interchanging A and B.