Thursday, February 23, 2012

Removing the redundancy file.txt

andre@fera:~$ cat file_A.txt
Desktop
Documents
Downloads
examples.desktop
Music

andre@fera:~$ cat file_B.txt
Desktop
Documents
Downloads
examples.desktop
Music
work
andre

#concatenating
andre@fera:~$ cat  cat file_A.txt cat file_B.txt > file_AB.txt

#removing the redundancy
andre@fera:~$ sort file_AB.txt | uniq > file_AB.uniq.txt

#number of lines
andre@fera:~$ wc -l file_AB.uniq.txt
7 file_AB.uniq.txt

#number of lines
andre@fera:~$ wc -l file_AB.txt
12 file_AB.txt

andre@fera:~$ cat file_AB.txt
Desktop
Documents
Downloads
examples.desktop
Music
Desktop
Documents
Downloads
examples.desktop
Music
work
andre

andre@fera:~$ cat file_AB.uniq.txt
andre
Desktop
Documents
Downloads
examples.desktop
Music
work

0 comentários:

Post a Comment