LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 12-14-2004, 07:51 AM   #1
subu_s
Member
 
Registered: Jun 2004
Posts: 36

Rep: Reputation: 15
Finding lines in file1,but not in file 2


Hi,
I had used a command for this once, but forgot.

I have two files test1 and test2

=====================
cat test1:-
ingres!ingresr30!generic!back!awsf!hdr wsfinit.h 2
ingres!ingresr30!generic!back!awsf!hdr wsfvar.h 6
ingres!ingresr30!generic!back!awsf!hdr sfvar.h 6

cat test2
ingres!ingresr30!generic!back!awsf!hdr sfvar.h: file not had on subutest
ingres!ingresr30!generic!back!awsf!hdr wsfvar.h: file not had on subutest
ingres!ingresr30!generic!back!awsf!hdr wsfinit.h 2
=====================

I want to find lines that are in test1, but not in test2.
So the o/p should be :-
ingres!ingresr30!generic!back!awsf!hdr wsfvar.h 6
ingres!ingresr30!generic!back!awsf!hdr sfvar.h 6

What should I do?

Thanks in advance.

Subu
 
Old 12-14-2004, 09:44 AM   #2
WW981
LQ Newbie
 
Registered: Jan 2004
Location: Danville, VA
Distribution: LFS
Posts: 1

Rep: Reputation: 0
Code:
grep -vhFxf test2 test1
 
Old 12-14-2004, 09:56 AM   #3
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,283

Rep: Reputation: 172Reputation: 172
or try
Quote:
man comm
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How can I sort the lines in a file? windhair Linux - Software 2 11-17-2005 08:37 AM
erase all the lines of a file Prasun1 Linux - General 9 11-06-2005 10:53 AM
How to remove lines from a file doza Linux - General 2 04-27-2005 11:59 AM
Removing lines from file Aylar Programming 2 04-22-2004 06:34 AM
delete some lines from a file freelinuxcpp Linux - Software 4 01-17-2004 10:28 AM


All times are GMT -5. The time now is 08:03 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration