Tuesday, January 27, 2015

linux shell: comm komutu kullanımı hakkında

comm - compare two sorted files line by line
 
iki dosyayı satır satır kıyaslayarak yapabileceğiniz işlemler için kullanılır.
 
örn: file1 ve file2  de tekrar eden satırları görmek istediğimiz durum için:


 
VirtualBox:~$ cat file1
A
B
C
D
E
F
G
 
 
 
VirtualBox:~$ cat file2
C
E
X
Y
Z
 
olsun

  
### file1 ve file2'de tekrar eden satırlar
 
VirtualBox:~$ comm -12 file1 file2
C
E
 
 
 
 
### file1'de olup file2'de olmayan satırlar
 
VirtualBox:~$ comm -32 file1 file2
A
B
D
F
G
 
 
 



EXAMPLES
       comm -12 file1 file2
              Print only lines present in both file1 and file2.

       comm -3 file1 file2
              Print lines in file1 not in file2, and vice versa

No comments:

Post a Comment