Solved

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

Posted on 2003-11-13
8
246 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

777 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