Register a domain and help support LQ
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


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

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

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.

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

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

Rep: Reputation: 165Reputation: 165
or try
man comm


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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 06:29 AM.

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