Diff Ignore blank spaces and line breaks

Asked

Viewed 119 times

1

Does anyone know any diff tool capable of ignoring all blank spaces and line breaks?

Ex:

File1.html
<html>
    <head>
        <title>Title</title>

File2.html
<html><head>
        <title>
            Title
        </title>

But when it comes to comparing:

File1.html
<html><head><title>Title</title>

File2.html
<html><head><title>Title</title>

1 answer

1

You can use the tool diff for that reason.

Argument -b: ignores changes in the amount of spaces blank.

diff -b arq_1.txt arq_2.txt

Argument -B: ignores changes in the amount of lines blank.

diff -B arq_1.txt arq_2.txt

Source: documentation of diff.

  • where did I say it had to do with git?

  • Opa, I think I hit my eye and then confused. You want to compare two files and see the differences ignoring the spaces and blank lines, this?

  • ignore line breaks and spaces.

  • I changed the answer, see if it fits your case :)

  • It didn’t work out on a virtual machine, and the result wasn’t what I expected.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.