Comm: 두 판 사이의 차이

내용 삭제됨 내용 추가됨
Alexbot (토론 | 기여)
잔글 로봇이 더함: en:Comm
Suenky613 (토론 | 기여)
편집 요약 없음
1번째 줄:
[[유닉스]] 안에서 '''<tt>comm</tt>''' 명령어는 일반적이고 뚜렷한 문자열들을 위해서 두 개의 [[파일들]]을 비교하기 위해서 사용되는 유틸리티이다. <tt>Comm</tt>은 [[POSIX]] 표준 안에서 지정된다. 이는 1980년 중반부터 후반까지 [[유닉스 계통]] 시스템에서 폭넓게 사용되고 있다..<!-- Case Larsen BSD 1989 (OpenBSD에서 찾아짐), Richard Stallman and David MacKenzie Gnu 1986 -->
{{lowercase}}
The '''<tt>comm</tt>''' command in [[Unix]] is a utility that is used to compare two [[computer file|files]] for common and distinct lines. <tt>Comm</tt> is specified in the [[POSIX]] standard. It has been widely available on [[Unix-like]] systems since the mid to late 1980s.<!-- Case Larsen BSD 1989 (as found in OpenBSD), Richard Stallman and David MacKenzie Gnu 1986 -->
==사용법==
 
<tt>comm</tt>은 텍스트의 문자열들에는 상관없이 두 파일들을 입력물로서 읽는다.<tt>comm</tt>은 하나의 파일을 출력하는데, 이는 세 개의 열들을 포함한다. 첫번째 두 열들은 첫번째와 두번째 파일과 같은 문자열들을 각각 포함한다. 마지막 열은 두 개의 파일들에 일반적인 문자열들을 포함한다. 이는 기능적으로 <tt>[[diff]]</tt>와 비슷하다.
==Usage==
 
열들은 일반적으로 <tt>''<nowiki><tab></nowiki>''</tt> 문자에 의해서 구분된다. 만약 입력되는 파일들이 구분자 문자로 시작되는 문자열들을 포함한다면, 출력되는 열들은 모호하게 될 수도 있다.
<tt>comm</tt> reads two files as input, regarded as lines of text. <tt>comm</tt> outputs one file, which contains three columns. The first two columns contain lines unique to the first and second file, respectively. The last column contains lines common to both. This functionally is similar to <tt>[[diff]]</tt>.
 
효율성을 위해서 <tt>comm</tt>의 표준 실행은 두 개의 입력된 파일들이 같은 문자열 콜래이션 순서로 정열되기를 기대한다. [[sort (Unix)]] 명령어는 이러한 목적으로 사용될 수 있다.
Columns are typically distinguished with the <tt>''<nowiki><tab></nowiki>''</tt> character. If the input files contain lines beginning with the separator character, the output columns can become ambiguous.
 
<tt>comm</tt> 알리고리즘은 현재 [[장소]]의 콜래이션 순서를 사용한다. 만약 파일 안의 문자열들이 현재 장소에 따라서 둘이 서로 순서가 맞지 않는다면, 그 결과는 정의될 수 없다.
For efficiency, standard implementations of <tt>comm</tt> expect both input files to be sequenced in the same line [[collation]] order. The [[sort (Unix)]] command can be used for this purpose.
 
==리턴 코드==
The <tt>comm</tt> algorithm makes use of the collating sequence of the current [[locale]]. If the lines in the files are not both collated in accordance with the current locale, the result is undefined.
 
<tt>diff</tt>와는 달리, <tt>comm</tt>로부터의 리턴 코드는 두 개의 파일들의 관계를 고려한, 어떠한 논리적인 중요성도 갖지 않는다. 0이라는 리턴코드는 성공을 의미하고, >0이라는 리턴 코드는 실행 중에 발생한 에러를 나타낸다.
==Return code==
 
==Example예시==
Unlike <tt>diff</tt>, the return code from <tt>comm</tt> has no logical significance concerning the relationship of the two files. A return code of 0 indicates success, a return code >0 indicates an error occurred during processing.
 
==Example==
 
File '''foo'''
줄 36 ⟶ 35:
zucchini
 
이는 두 개의 파일이 하나의 바나나를 갖고 있으나 오직 '''bar'''만이 두번째 바나나를 갖고 있음을 보여준다.
This shows that both files have one banana, but only '''bar''' has a second banana.
 
더 자세하게, 출력되는 파일은 다음과 같은 특징을 갖는다. 열이 앞선 탭 문자의 순자에 의해서 해석됨을 주의하라. \t은 탭 문자를 나타내고 \n은 뉴라인([[C 언어]] 표기)를 나타낸다. 표시되는 스페이스들은 출력되는 파일의 일부가 아니다.
 
In more detail, the output file has the appearance that follows. Note that the column is interpreted by the number of leading tab characters. \t represents a tab character and \n represents a newline ([[C (programming language)|C language]] notation). The spaces shown are not part of the output file.
<small>
\t \t a p p l e \n
47번째 줄:
</small>
 
==Comparisondiff와의 to diff비교==
 
In general terms, <tt>diff</tt> is a more powerful utility than <tt>comm</tt>. The simpler <tt>comm</tt> is best suited for use in scripts.
일반적인 관점에서 <tt>diff</tt>은 <tt>comm</tt>보다 훨씬 강력한 유틸리티이다. 더 단순한 <tt>comm</tt>은 스크립트 안의 사용에 최적이다.
 
The primary distinction between <tt>comm</tt> and <tt>diff</tt> is사이의 that중요한 차이점은 <tt>comm</tt> discards분류하기 information이전의 about문자열 the순서에 order대한 of정보를 the폐기한다는 lines prior to sorting것이다.
 
<tt>comm</tt>와 <tt>diff</tt>의 사이의 사소한 차이점은 <tt>comm</tt>이 두 개의 파일들 사이의 "변화된" 문자열을 표시할려고 하지 않는다는 점이다; 문자열이 "file #1로부터", "file #2로부터", 이나 "두 개 파일" 열들 안에 표시될 수 있다. 비록 그 차이가 미묘할지라도 두 개의 문자열들이 다르게 구분되기를 바란다면 이는 유용할 수 있다.
A minor difference between <tt>comm</tt> and <tt>diff</tt> is that <tt>comm</tt> will not try to indicate that a line has "changed" between the two files; lines are either shown in the "from file #1", "from file #2", or "in both" columns. This can be useful if one wishes two lines to be considered different even if they only have subtle differences.
 
==Other다른 options옵션들==
 
'''<tt>comm</tt>''' has options개의 to suppress any아무거나 of억누를 the three있는 columns옵션들을 갖는다. 이는 This is useful스크립팅하는데 for있어서 scripting유용하다.
 
표준 입력물로부터 하나의 파일(두 개의 파일은 아님)을 읽는 옵션이 있다.
There is also an option to read one file (but not both) from standard input.
 
==Limits한계==
 
다음 출력어가 쓰여지기 전까지 문자열을 비교하는 동안, 전체 입력어까지는 각각의 입력된 파일들로부터 반드시 버퍼링되어야 한다.
Up to a full line must be buffered from each input file during line comparison, before the next output line is written.
 
어떤 실행들은 만약 시스템 메모리가 충분하다면 문자열 길이에 제약을 가하지 않는 <tt>readlinebuffer()</tt> 기능으로 문자열을 읽는다.
Some implementations read lines with the function <tt>readlinebuffer()</tt> which does not impose any line length limits if system memory suffices.
 
Other다른 implementations실행들은 read lines with the function <tt>[[fgets|fgets()]]</tt>. This function requires a기능으로 fixed문자열들을 buffer읽는다. For기능은 these고정된 implementations,버퍼를 the필요로 buffer한다. is이러한 often실행들에 sized있어서, according버퍼는 to the종종 [[POSIX]] macro <tt>LINE_MAX</tt>에 따라서 크기가 주어진다.
 
== See함께 also보기 ==
*[[Comparison of file comparison tools]]
*[[List of Unix programs]]
*[[cmp (Unix)]] -- character문자열 oriented지향적인 file파일 comparison비교
*[[cut (Unix)]] -- splitting column지향적인 oriented파일들 files분리
 
== References레퍼런스 ==
*{{man|cu|comm|SUS|select or reject lines common to two files}}
*{{man|1|comm||compare two sorted files line by line}}