LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 06-04-2013, 08:00 AM   #1
papori
LQ Newbie
 
Registered: Feb 2011
Posts: 23

Rep: Reputation: 0
lookfor matching strings between 2 files


Hi all,
I have a basic procedure that i want to create..
Assuming that I have 2 files.
In each file i have list of 30 words.
i want to lookfor the first word in list 1, if it found also in list 2.
if it is, keep the line number in file.
if not, keep the word in different file.
Any idea on short/easy solution?

Thanks,
Pap
 
Old 06-04-2013, 08:04 AM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
using grep (with -n option) within a while loop will probably get what you want.
 
  


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
Scripting- sed command - replacing strings excluding the lines matching a pattern(s) msriram Linux - General 1 11-05-2012 09:29 AM
Appending matching strings to specific lines (sed/bash) suntzu Programming 18 09-08-2012 03:29 PM
[SOLVED] Searching and replacing strings in a file with strings in other files xndd Linux - Newbie 16 07-29-2010 02:40 PM
regex : matching strings of a unknown lenghtr stevie_velvet Programming 5 07-16-2006 10:56 PM
Problem matching strings with grep/egrep Seb74 Linux - Newbie 5 05-26-2005 01:40 PM

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

All times are GMT -5. The time now is 12:59 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