日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux diff(differential) 命令

發布時間:2025/4/5 linux 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux diff(differential) 命令 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

功能說明:比較文件的差異

語法:diff [OPTION]... FILES

實例:

diff -ur temp1 temp2

diff -ur temp1 temp2 > temp.diff

option詳細:

?

--normaloutput a normal diff (This is the default).
-q,?--briefreport only when files differ.
-s,?--report-identical-filesreport when two files are the same.
-c,?-C?NUM,?--context[=NUM]output NUM (default 3) lines of copied context.
-u,?-U?NUM,?--unified[=NUM]output NUM (default 3) lines of unified context.
-e,?--edoutput an?ed?script.
-n,?--rcsoutput an?RCS-format diff.
-y,?--side-by-sideoutput in two columns.
-W,?--width=NUMoutput at most NUM (default 130) print columns.
--left-columnoutput only the left column of common lines.
--suppress-common-linesdo not output common lines.
-p,?--show-c-functionshow which C function each change is in.
-F,?--show-function-line=REshow the most recent line matching RE.
--label?LABELuse LABEL instead of file name (this option can be repeated).
-t,?--expand-tabsexpand tabs to spaces in output.
-T,?--initial-tabmake?tabs?line up by prepending a tab.
--tabsize=NUMtab stops every NUM (default 8) print columns.
--suppress-blank-emptysuppress space or tab before empty output lines.
-l,?--paginatepass output through?pr?to paginate it
-r,?--recursiverecursively?compare any?subdirectories?found.
-N,?--new-filetreat absent files as empty.
--unidirectional-new-filetreat absent first files as empty.
--ignore-file-name-caseignore case when comparing file names.
--no-ignore-file-name-caseconsider case when comparing file names.
-x,?--exclude=PATexclude files that match PAT.
-X,?--exclude-from=FILEexclude files that match any pattern in FILE.
-S,?--starting-file=FILEstart with FILE when comparing?directories.
--from-file=FILE1compare FILE1 to all?operands; FILE1 can be a directory.
--to-file=FILE2compare all operands to FILE2; FILE2 can be a directory.
-i,?--ignore-caseignore case differences in file contents.
-E,?--ignore-tab-expansionignore changes due to?tab?expansion.
-b,?--ignore-space-changeignore changes in the amount of?white space.
-w,?--ignore-all-spaceignore all white space.
-B,?--ignore-blank-linesignore changes whose lines are all blank.
-I,?--ignore-matching-lines=REignore changes whose lines all match RE.
-a,?--texttreat all files as text.
--strip-trailing-crstrip trailing?carriage return?on input.
-D,?--ifdef=NAMEoutput merged file with `#ifdef NAME' diffs.
--GTYPE-group-format=GFMTformat GTYPE input groups with GFMT.
--line-format=LFMTformat all input lines with LFMT.
--LTYPE-line-format=LFMTformat LTYPE input lines with LFMT.

These format options provide fine-grained control over the output of diff, generalizing?-D/--ifdef.

LTYPE is 'old', 'new', or 'unchanged'. GTYPE is LTYPE or `changed'.

GFMT (only) may contain:

%<: lines from FILE1

%>: lines from FILE2

%=: lines common to FILE1 and FILE2.

%[-][WIDTH][.[PREC]]{doxX}LETTER:?printf-style spec for LETTER

LETTERs are as follows for new group, lower case for old group:

F: first line number

L: last line number

N: number of lines = L-F+1

E: F-1

M: L+1

%(A=B?T:E)?if A equals B then T else E

LFMT (only) may contain:

%L: contents of line

%l: contents of line, excluding any trailing newline

%[-][WIDTH][.[PREC]]{doxX}n: printf-style spec for input line number

Both GFMT and LFMT may contain:

%%: A literal '%'

%c'C': the single character C?%c'\OOO': the character with?octal?code OOOC: the character C (other characters represent themselves)
-d,?--minimaltry hard to find a smaller set of changes.
--horizon-lines=NUMkeep NUM lines of the common prefix and suffix.
--speed-large-filesassume large files and many scattered small changes.
--helpdisplay a help message and exit.
-v,?--versionoutput version information and exit.

?

?

轉載于:https://www.cnblogs.com/davidwang456/p/3518369.html

《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的linux diff(differential) 命令的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。