07-16-2009
If you have the GNU diff, look at the -t option which expands tabs to spaces. See if that works.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I want to compare two files. All records in file 2 that are not in file 1 should be output to file 3.
For example:
file 1
123
1234
123456
file 2
123
2345
23456
file 3 should have
2345
23456
I have looked at diff, bdiff, cmp, comm, diff3 without any luck! (2 Replies)
Discussion started by: blt123
2 Replies
2. UNIX for Dummies Questions & Answers
I have file1 and file2. I am trying to get the difference between the two of them to another file? I have tried diff and fgrep with no luck.. I dont think I am using the proper switches to make this happen.
Can someone please give me the key to this lock?
Muchos Thanks.
Tbone (2 Replies)
Discussion started by: jtrevinojr
2 Replies
3. Shell Programming and Scripting
I need to compare 2 diff type of files and find out the duplicate after comparing each types of files:
Type 1 file name is like: file1.abc
(the extension abc could any 3 characters but I can narrow it down or hardcode for 10/15 combinations).
The other file is file1.bcd01abc (the extension... (2 Replies)
Discussion started by: ricky007
2 Replies
4. Shell Programming and Scripting
Hi,
I have 2 files.I want to check if file1 is contained in file2.
A.txt:
-----
AAA
BBB
B.txt:
------
CCC
AAA
BBB
DDD
I want to check if A.txt is contained in B.txt. Can it be done using SED ? (12 Replies)
Discussion started by: giri_luck
12 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I use the diff command to compare two files and append this output to a file. I would like to now not only produce the differences but be able to output the total number of changes made, the number of new files added and the number of files deleted, is there I can do this using the diff... (2 Replies)
Discussion started by: cyberfrog
2 Replies
6. Shell Programming and Scripting
Hi All,
I have two files which look as below
File1
serial="1" name="abc" type="employee" field="IT"
serial="2" name="cde" type="intern" field="Marketing"
serial="3" name="pqr" type="contractor" field="IT"
serial="4" name="xyz" type="employee" field="Sales"
File2
serial="1"... (3 Replies)
Discussion started by: grajp002
3 Replies
7. Shell Programming and Scripting
Hi
I've been trying various methods that I have found online with regards to comparing 2 files using the diff command. Nothing seems to work. The problem is that I'm not too familiar with the proper syntax. Can you please assist me. Here is my script:
#!/bin/bash
awk -F',' -v file1="$1"... (9 Replies)
Discussion started by: ladyAnne
9 Replies
8. Shell Programming and Scripting
Moderator, please, delete this topic (1 Reply)
Discussion started by: optik77
1 Replies
9. Shell Programming and Scripting
Hi,
I need a small help to compare two PIPE delimited files.
Note : All The Files Have A Column Name
Example:
file1.txt
=================
column1|column2|column3
one|two|three
four|five|six
seven|eight|nine
file2.txt
=================
column1|column2|column3
1|two|three... (2 Replies)
Discussion started by: anshultongia
2 Replies
10. Shell Programming and Scripting
Guys i have 3 files,
but i want to compare and diff only the 2nd column
path=`/home/whois/doms`
for i in `cat domain.tx`
do
whois $i| sed -n '/Registry Registrant ID:/,/Registrant Email:/p' > $path/$i.registrant
whois $i| sed -n '/Registry Admin ID:/,/Admin Email:/p' > $path/$i.admin... (10 Replies)
Discussion started by: kenshinhimura
10 Replies
DIFF(1) General Commands Manual DIFF(1)
NAME
diff - differential file comparator
SYNOPSIS
diff [ -efbwr ] file1 ... file2
DESCRIPTION
Diff tells what lines must be changed in two files to bring them into agreement. If one file is a directory, then a file in that directory
with basename the same as that of the other file is used. If both files are directories, similarly named files in the two directories are
compared by the method of diff for text files and cmp(1) otherwise. If more than two file names are given, then each argument is compared
to the last argument as above. The -r option causes diff to process similarly named subdirectories recursively. The normal output con-
tains lines of these forms:
n1 a n3,n4
n1,n2 d n3
n1,n2 c n3,n4
These lines resemble ed commands to convert file1 into file2. The numbers after the letters pertain to file2. In fact, by exchanging `a'
for `d' and reading backward one may ascertain equally how to convert file2 into file1. As in ed, identical pairs where n1 = n2 or n3 = n4
are abbreviated as a single number.
Following each of these lines come all the lines that are affected in the first file flagged by `<', then all the lines that are affected
in the second file flagged by `>'.
The -b option causes trailing blanks (spaces and tabs) to be ignored and other strings of blanks to compare equal. The -w option causes
all white-space to be removed from input lines before applying the difference algorithm.
The -e option produces a script of a, c and d commands for the editor ed, which will recreate file2 from file1. The -f option produces a
similar script, not useful with ed, in the opposite order. It may, however, be useful as input to a stream-oriented post-processor.
Except in rare circumstances, diff finds a smallest sufficient set of file differences.
FILES
/tmp/diff[12]
SOURCE
/sys/src/cmd/diff
SEE ALSO
cmp(1), ed(1)
DIAGNOSTICS
Exit status is the empty string for no differences, for some, and for trouble.
BUGS
Editing scripts produced under the -e or -f option are naive about creating lines consisting of a single `.'.
When running diff on directories, the notion of what is a text file is open to debate.
DIFF(1)