Poređenje dva fajla pod Linux-om

Kako porediti dva fajla pod Linux-om :
Imamo dva fajla FILE1 FILE2. Komanda diff će pregledati oba fajla i prikazati promene koje treba uraditi da bi fajlovi bili isti :

Dodati (a)
Obrisati (d)
Promeniti (c)
Dodatne linije (<) i sa (>) simbolima.

Ovako :
#diff file1.txt file2.txt
Izlaz :
8c8,9
URL: www.nixcraft.in
> Email: support@nixcraft.in

Sadrtžaj fajlova :
$ cat file1.txt
If undeliverd return to nixCraft
#404, DC bay area, 2nd phase,
Pune.
Ph: 555-11112223
URL: www.nixcraft.com

$ cat file2.txt
If undeliverd return to nixCraft
#404, DC bay area, 2nd phase,
Pune.
Ph: 555-11112223
URL: www.nixcraft.in
Email: support@nixcraft.in

A poređenje fajlova sa izlistavanjem :
$ sdiff file1.txt file2.txt
Izlaz :
If undeliverd return to nixCraft If undeliverd return to nixCraft
#404, DC bay area, 2nd phase, #404, DC bay area, 2nd phase,
Pune. Pune.
Ph: 555-11112223 Ph: 555-11112223
URL: www.nixcraft.com | URL: www.nixcraft.in
> Email: support@nixcraf

This entry was posted in Linux and tagged , . Bookmark the permalink.

Comments are closed.