Find difference in content between two particular lines in two files

I have two files named Before.txt and After.txt:

Now i want to find the difference in content between <Marker 1> and <Marker 2> in the two files.

---------- Post updated at 05:00 PM ---------- Previous update was at 04:50 PM ----------

Any help will be highly appreciated..:slight_smile:

Using diff with process substitution:

$ diff <(sed -n '/<Marker 1>/,/<Marker 2>/p' before.txt) <(sed -n '/<Marker 1>/,/<Marker 2>/p' after.txt)

Thanks, but how can i get only the content between the two markers, in the above case the markers also come in the output.

Hello,

You must just modify the 2 sed command like:

sed -n '/<Marker 1>/,/<Marker 2>/{/<Marker 1>\|<Marker 2>/!p}'

Regards.