Diff in UNIX


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Diff in UNIX
# 1  
Old 05-21-2014
Diff in UNIX

Hi guys - I have two files that have random number values and I want to see what is available in file A and not in file B

Here is what each file looks like:

Code:
File A:
 
1
45
11
788
556
 
File B:
 
774
1
5589
788
10025

I would like to know that File B did not had 45, 11, 556
# 2  
Old 05-21-2014
Code:
awk 'FNR==NR {fb[$1];next} !($1 in fb)}' fileB fileA

# 3  
Old 05-21-2014
comes as error:

Code:
 
awk: FNR==NR {fb[$1];next} !($1 in fb)}
awk:                                  ^ syntax error

# 4  
Old 05-21-2014
sorry:
Code:
awk 'FNR==NR {fb[$1];next} !($1 in fb)' fileB fileA

This User Gave Thanks to vgersh99 For This Post:
# 5  
Old 05-21-2014
thanks!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

diff command in Unix

Hi I want to compare two rows in unix first value in row is 1.12 while value in other row is 000001.12. if i do normal diff this will come as difference...is it any way to overcome this? (1 Reply)
Discussion started by: sanranad
1 Replies

2. Shell Programming and Scripting

serach diff filename in diff location using shell scripting

Hi, I am new to shell scripting. please help me to find out the solution. I need a script where we need to read the text file(consists of all file names) and get the file names one by one and append the date suffix for each file name as 'yyyymmdd' . Then search each file if exists... (1 Reply)
Discussion started by: Lucky123
1 Replies

3. Shell Programming and Scripting

.procmailrc and uudeview (put attachments from diff senders to diff folders)

Moderator, please, delete this topic (1 Reply)
Discussion started by: optik77
1 Replies

4. Shell Programming and Scripting

unix diff with numerical precision

Hi, I search a unix utility to diff two files, that takes as argument numerical precision as well. If two files are different only in numbers and the difference is less than precision then the result as they are the same. The precision may be absolute (x1-x2) or relative (x2/x1). Also I need the... (1 Reply)
Discussion started by: stella
1 Replies

5. UNIX for Advanced & Expert Users

Problem using diff command in unix

Hi, I am trying to do a diff between two files using "diff" command.I dont need my output to be printed using extra symbols ">" and "<" as we usually see for the diff command. Even to excude these characters in each line of the output, my diff output has inturn many symbols ">" and "<". ... (1 Reply)
Discussion started by: pharitha
1 Replies

6. UNIX for Dummies Questions & Answers

diff between unix and linux

can some 1 tel me wat is difference between unix and linux. and from where i can download unix for free (5 Replies)
Discussion started by: rohansaurav
5 Replies

7. Shell Programming and Scripting

UNIX Guru's help on diff

Hi , I wanted to find delata between two huge ( 8 GB ) files . Say file_TDY and file_YDY : These files are sorted based on a key . I am using a command : 1)bdiff file_TDY file_YDY > diff_file 2) grep ' ^< ' diff_file > TDY_delta I wanted only the changed records and newly added... (2 Replies)
Discussion started by: ajaybalki
2 Replies

8. Shell Programming and Scripting

can we diff 3 files in Unix

Dear ALL I need help in diff command can we do diff of 3 files .. I want to compare 3 files (1 Reply)
Discussion started by: getdpg
1 Replies

9. Shell Programming and Scripting

Diff between Unix and Windows

Hi All, In my work environment, our workis to run N number of SQL statements continously.. Actually we are in testing environment. And for this we write 100 of SQL's and execute each one after another at Windows SQL prompt. Some of the SQL's will be running for about 12 hrs also. ... (1 Reply)
Discussion started by: cheche
1 Replies
Login or Register to Ask a Question