리눅스 두 파일 행 차집합

(리눅스 파일 행 차집합에서 넘어옴)

1 개요[ | ]

리눅스 파일 행 차집합
리눅스 파일 내용 차집합
A
root@wsl:~# cat a.txt
11
22
33
44
55
B
root@wsl:~# cat b.txt
22
44
66

2 comm 사용[ | ]

A-B
root@wsl:~# comm -23 a.txt b.txt
11
33
55
B-A
root@wsl:~# comm -23 b.txt a.txt
66

3 diff 등 사용[ | ]

A-B
root@wsl:~# diff -u a.txt b.txt | grep ^- | sed 1d | cut -c 2-
11
33
55
B-A
root@wsl:~# diff -u b.txt a.txt | grep ^- | sed 1d | cut -c 2-
66

4 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}