cmp командасы: Unix жүйесінде файлдарды салыстыру құралы. Екі файлдың өзгешеліктерін анықтап, алғашқы айырмашылықтың байттарын көрсетеді. POSIX стандартында бар.
Ағылшыншамен салыстырыңыз: абзацты басыңыз — түпнұсқа терезеде ашылады. Абзац астындағы EN түймесі оны мәтін ішінде көрсетеді.
Мазмұны
Кіріспе
Компьютерлік файлдарды салыстыру құралы
Computer file comparison utility
Компьютерде, cmp – Unix және Unix-қа ұқсас операциялық жүйелердегі екі кез келген файлды салыстырып, нәтижелерін стандартты шығысқа жазатын командалық жол құралы. Әдепкі бойынша, файлдар бірдей болса, cmp ешқандай хабарлама бермейді; егер олар өзгеше болса, алғашқы айырмашылық пайда болған байт пен жол нөмірі туралы хабарлама жіберіледі. Бұл команда OS 9 қабығында да қолжетімді.
In computing, cmp is a command line utility on Unix and Unix like operating systems that compares two files of any type and writes the results to the standard output. By default, cmp is silent if the files are the same; if they differ, the byte and line number at which the first difference occurred is reported. The command is also available in the OS 9 shell.
Тарих
1987 жылғы 2-ші нұсқасынан бастап X/Open Portability Guide құрамына кіреді. Ол POSIX.1 және Single Unix Specification-тің бірінші нұсқасына көшті. Алғаш рет Unix 1-ші нұсқасында пайда болды. GNU coreutils жинағындағы cmp нұсқасын Торбьорн Гранлунд және Дэвид МакКензи жазған. Бұл команда Microsoft Windows үшін UnxUtils жинағының бөлігі ретінде жеке пакет түрінде қолжетімді, ол көптеген GNU Unix сияқты утилиталардың Win32-ге түпнұсқалық порты болып табылады. Команда сонымен қатар IBM i операциялық жүйесіне де көшірілген.
is part of the X/Open Portability Guide since issue 2 of 1987. It was inherited into the first version of POSIX.1 and the Single Unix Specification. It first appeared in Version 1 Unix. The version of cmp bundled in GNU coreutils was written by Torbjorn Granlund and David MacKenzie. The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix like utilities. The command has also been ported to the IBM i operating system.
Ауыстырғыштар
cmp командалық жолға қосылатын параметрлер арқылы жұмыс істей алады. cmp-тің кең таралған нұсқалары қолдайтын параметрлер:
cmp may be qualified by the use of command line switches. The switches supported by notable implementations of cmp are:
Атауы Сипаттамасы Unix Plan 9 Inferno FreeBSD Linux IBM i b, print bytes Ерекше байттарды басып шығару. Бақылау байттарын '^' таңбасымен, ал жоғары биті орнатылған байттарды 'M ' (мета) деп белгіленген таңбамен көрсету. ✔ h Символдық сілтемелерді қабылдамау. ✔ i SKIP, initial=SKIP елемеу Кірістің бастапқы SKIP байтын жіберу. ✔ i SKIP1:SKIP2, ignore initial=SKIP1:SKIP2 FILE1 бастапқы SKIP1 байтын және FILE2 бастапқы SKIP2 байтын жіберу. ✔ l, verbose Әдеттегі стандартты шығысқа орналастырудың орнына, барлық ерекше байттардың (ондық) нөмірін және (сегіздік) мәнін шығару. Сондай-ақ, егер бір файл екіншісінен қысқа болса, EOF хабарламасын шығару. ✔ ✔ ✔ ✔ ✔ L Бірінші ерекше байттың жол нөмірін басып шығару. ✔ ✔ ✔ n LIMIT, байт=LIMIT Ең көп дегенде LIMIT байтты салыстыру. ✔ s, тыныш, үнсіз Ештеңе шығармау; тек шығу статусын беру. ✔ ✔ ✔ ✔ ✔ t Мәтіндік режим, онда файлдар мәтіндік режимде ашылады және байт бойынша салыстыру алдында жұмыс CCSID-ге аударылады. ✔ v, нұсқасы Нұсқа туралы ақпаратты шығару. ✔ x L сияқты, бірақ гексадецималдық форматта басып шығару және файлдардағы бірінші байттың индексі ретінде нөлді пайдалану. ✔ z Қалыпты файлдар үшін алдымен файл мөлшерін салыстыру және олар тең болмаса, салыстыруды тоқтату. ✔ help Көмек файлы шығару. ✔
Name Description Unix Plan 9 Inferno FreeBSD Linux IBM i b, print bytes Print the differing bytes. Display control bytes as a '^' followed by a letter of the alphabet and precede bytes that have the high bit set with 'M ' (which stands for "meta"). ✔ h Do not follow symbolic links. ✔ i SKIP, ignore initial=SKIP Skip the first SKIP bytes of input. ✔ i SKIP1:SKIP2, ignore initial=SKIP1:SKIP2 Skip the first SKIP1 bytes of FILE1 and the first SKIP2 bytes of FILE2. ✔ l, verbose Output the (decimal) byte numbers and (octal) values of all differing bytes, instead of the default standard output. Also, output the EOF message if one file is shorter than the other. ✔ ✔ ✔ ✔ ✔ ✔ L Print the line number of the first differing byte. ✔ ✔ ✔ n LIMIT, bytes=LIMIT Compare at most LIMIT bytes. ✔ s, quiet, silent Output nothing; yield exit status only. ✔ ✔ ✔ ✔ ✔ ✔ t Text mode where the files are opened in text mode and translated to the CCSID of the job before comparing byte for byte. ✔ v, version Output version info. ✔ x Like l but prints in hexadecimal and using zero as index for the first byte in the files. ✔ z For regular files compare file sizes first, and fail the comparison if they are not equal. ✔ help Outputs a help file. ✔
Байт саны болып табылатын аргументтер әдетте ондық болып келеді, бірақ сегіздік үшін '0' және он алтылық үшін '0x' префиксімен жазылуы мүмкін. Байт санынан кейін осы санның еселігін көрсету үшін қосымша жазу мүмкін; мұндай жағдайда, алынып тасталған бүтін сан 1 ретінде түсініледі. Әріптің артынан 'iB' жазылса, 1024-тің дәрежелерін пайдаланып еселік көрсетіледі. Әріптің артынан 'B' жазылса, 1000-ның дәрежелері пайдаланылады. Мысалы, 'n 4M' және 'n 4MiB' 'n 4194304' дегенмен тең, ал 'n 4MB' 'n 4000000' дегенмен тең. Бұл жазу ондық еселіктерге арналған SI префикстерімен және бинарлық еселіктерге арналған IEC 60027 2 префикстерімен үйлесімді.
Operands that are byte counts are normally decimal, but may be preceded by '0' for octal and '0x' for hexadecimal. A byte count can be followed by a suffix to specify a multiple of that count; in this case an omitted integer is understood to be 1. A bare size letter, or one followed by 'iB', specifies a multiple using powers of 1024. A size letter followed by 'B' specifies powers of 1000 instead. For example, ' n 4M' and ' n 4MiB' are equivalent to ' n 4194304', whereas ' n 4MB' is equivalent to ' n 4000000'. This notation is upward compatible with the SI prefixes for decimal multiples and with the IEC 60027 2 prefixes for binary multiples.