Solved

A script that produces as output not the identical lines but the different

Posted on 2003-11-13
8
242 Views
Last Modified: 2013-12-27
I have the 2 files file1 and file2
the 2 files have the following records per line
xx1@yahoo.com
xxxddd@yahoo.com

A big number of records are identical in file 1 and file2
I have truied to concatenate
cat file1 >> file2
and sort file2
and make
uniq -u file2
in order to receive only the different lines and not the common but it doesn't work.
What command can I use in order to do it?
0
Comment
Question by:vage78
8 Comments
 
LVL 38

Accepted Solution

by:
yuzh earned 20 total points
ID: 9745878
cat file2 | sort -u > file2
0
 

Author Comment

by:vage78
ID: 9746057
Hi yuzh
It doesn't works. I only want the lines that exist only ONE time in my file. I don't want to receive the adiacent lines that are identical
0
 
LVL 6

Expert Comment

by:durindil
ID: 9748695
can you use diff?

> diff file1 file2
0
 
LVL 1

Expert Comment

by:meff
ID: 9750176
Hi!

Yes.
sort -u (as yuzh said)
diff (as durindil said)
also try 'comm' - it may happen that's you're looking for (read man carefully - or you may not achieve a good result!).

meff
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:vage78
ID: 9761861
Hi
My problem is that after cutting off the spaces at my file
when I'm making
uniq -u file2
are not coming out the unique lines contrarily come all.
What can  do?
0
 

Expert Comment

by:sagar24
ID: 9785291
hi
I think you use
command  comm.
ust out the details for this command using
man comm

Regards
sagar
0
 

Expert Comment

by:sagar24
ID: 9785295
hi
I think you use
command  comm -3 file1 file2.
find more details for this command using
man comm

Regards
sagar
0
 

Author Comment

by:vage78
ID: 10234253
thanks
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now