?
Solved

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

Posted on 2003-11-13
8
Medium Priority
?
262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 38

Accepted Solution

by:
yuzh earned 60 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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…
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.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

770 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