Solved

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

Posted on 2003-11-13
8
250 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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
 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
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 find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

790 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