“-” – Indicate that first file has a line that needs to be deletedĮxample 5 : diff -u.“+” – Indicate that second file has a line that needs to be added in first file.“!” – indicate that this line is part of a group of one or more lines that needs to change.Following is the meaning of (“!,+,-“) that is displayed on subsequent lines. The next line has three asterisks(“***”) followed by the changed lines from first file and then it will be followed by four asterisks. The line with fifteen asterisks is a separator. ![]() The first file will be indicated by three asterisks and second file will be indicated by (“-“). It also lists modification date and modification time of each file along with the filename. In the output, first two lines will show us information related to file1 and file2. Lets understand the output of this command. The -c is the context mode of the “diff” command allows you to view additional information related to the specified files. w ignore all the spaces and compare recursively and display the comparisonĮxample 4 : diff -c. the dashes (“-“) will separate file1 and file2Įxample 3 : diff -rw.Lines preceded with a are the lines from the second file.Then it also displays the lines that got changed in each file. In our output “1,3c1,3” means like 1-3 is changed in first file when compared to the second file. line numbers related to the second file.a letter (a for add, c for change and d for delete). ![]() The first line of diff output contains the following information Lets take a look at what is output means. test1/policy.js differĬompare recursively in both the directories (test and test1) and display the comparison. That’s why it will display only filenames. In the above command as we have given -q it will display briefly. It will compare recursively in both the directories (test and test1) and display all the file names that are different. no-ignore-file-name-case : Consider case when comparing file names. ignore-file-name-case : Ignore case when comparing file names. ignore-case : Ignore case differences in file contents. i-ignore-blank-lines : Ignore changes whose lines are all blank. B -ignore-blank-lines : Ignore changes whose lines are all blank. w -ignore-all-space : Ignore all white space. b -ignore-space-change : Ignore changes in the amount of white space. y -side-by-side : Output in two columns. q -brief : Output only whether files differ. r -recursive : Recursively compare any subdirectories found.
0 Comments
Leave a Reply. |