LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-08-2012, 12:22 AM   #1
Vthimmap
Member
 
Registered: Oct 2012
Posts: 36

Rep: Reputation: Disabled
Unhappy Find out the Diff of 2 files with column1


ex: two files

file1 file2
cn va cn va
USA 6 USA 4
TWN 1 GBR 2
GRC -4 IND 0
PAK 3 PAK 5

Here the files has 2 columns. Need the difference in files with respect to column 1.
 
Old 11-08-2012, 04:57 PM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
You should use [code]code-tags[/code]

Could you please tell us what you've tried out so far? as you know we don't do your homework for you.

Markus
 
Old 11-08-2012, 05:34 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Here's a quick n dirty possible soln, just for fun
(in fact I knocked it up as a one liner, but its tricky to read)
Code:
for str in `cat t1.t|awk '{print $1}'`
do 
    grep $str t2.t>/dev/null 
    if [[ $? -ne 0 ]]
    then
        echo $str
    fi
done
Definitely not the best soln and it depends on exactly what you want to see as results.

Anyway, here's some good links
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using diff to find new files in a directory tree madpear Programming 2 12-10-2009 10:27 AM
diff files elainelaw Linux - Software 2 07-23-2009 05:52 AM
diff two files noir911 Linux - Server 3 03-25-2009 05:00 PM
is it possible to diff ps files? markhod Linux - General 8 09-05-2005 12:17 AM
.diff files? jtsai256 Linux - Newbie 1 09-28-2003 02:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration