development

유닉스 차이점 좌우 결과?

big-blog 2020. 9. 15. 18:53
반응형

유닉스 차이점 좌우 결과?


유닉스 diff 명령의 결과를 차례로 다른 차이 대신 나란히 플롯 할 수 있습니까? 예는 아래를 참조하십시오.

    diff /tmp/test1  /tmp/test2
1,4c1,2
< asfdsadf
< asdfsad
< fsaf
< fdsadf
---
> asdfsafdsf
> saf
6,8d3
< sadf
< asdf
< sadf
10d4
< fasd
12,13c6,14
< sadfa
< fd
---
> sadf
> sadf
> sadf
> sadf
> sadf
> sadf
> sadf
> sadf
> safa

나는 다음과 같은 것을 갖고 싶다.

diff /tmp/test1  /tmp/test2
1,4c1,2
< asfdsadf       > asdfsafdsf
< asdfsad        > saf       
< fsaf
< fdsadf
---
6,8d3
< sadf
< asdf
< sadf
10d4
< fasd
12,13c6,14
< sadfa               > sadf
< fd              > sadf
---               > sadf
              > sadf
              > sadf
              > sadf
              > sadf
              > sadf
              > safa

에서 man diff를 사용 -y하여 나란히 할 수 있습니다 .

-y, --side-by-side
       output in two columns

따라서 다음과 같이 말하십시오.

diff -y /tmp/test1  /tmp/test2

테스트

$ cat a                $ cat b
hello                  hello
my name                my name
is me                  is you

비교해 봅시다 :

$ diff -y a b
hello                                                           hello
my name                                                         my name
is me                                                         | is you

icdiff 홈페이지에서 :

enter image description here

터미널은 색상을 표시 할 수 있지만 대부분의 diff 도구는 색상을 잘 사용하지 않습니다. 변경 사항을 강조 표시함으로써 icdiff는 방해가되지 않고 유사한 파일 간의 차이점을 보여줄 수 있습니다. 이는 기존 라인 내의 작은 변경 사항을 식별하고 이해하는 데 특히 유용합니다.

Instead of trying to be a diff replacement for all circumstances, the goal of icdiff is to be a tool you can reach for to get a better picture of what changed when it's not immediately obvious from diff.

IMHO, its output is much more readable than diff -y.


You can use:

sdiff  file1 file2

or

diff -y file1 file2

or

vimdiff file1 file2

for side by side display.


You should have sdiff for side-by-side merge of file differences. Take a read of man sdiff for the full story.


diff -y --suppress-common-lines file1 file2

You can simply use:

diff -y fileA.txt fileB.txt | colordiff

It shows the output splitted in two colums and colorized! (colordiff)


Use the -y option:

diff -y file1 file2

Try cdiff - View colored, incremental diff in workspace or from stdin with side by side and auto pager support.


You can use vimdiff.

Example:

vimdiff file1 file2

If your files have inconsistent use of spaces and tabs, you may find it helpful to include the -t argument to expand the tabs:

diff -ty file1 file2

참고URL : https://stackoverflow.com/questions/17195308/unix-diff-side-to-side-results

반응형