LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 03-17-2016, 11:49 AM   #16
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306

in that case I would suggest you a recursive approach:
(pseudo-code):
Code:
first make a copy of hay
# the external loop remains
while read needle; do
    # look for this needle
    grep -m1 [-F] " $needle " hay
    # drop lines containing this needle
    grep -v " $needle " hay > hay1
    mv hay1 hay
done < needles >> results
 
  


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
[SOLVED] bash: Speeding up a script? DJCharlie Programming 25 01-19-2011 07:11 PM
bash and simple loop: error frenchn00b Programming 2 01-24-2010 05:48 PM
simple BASH while loop question / Array riotxix Programming 10 01-03-2010 08:57 PM
BASH code problem - a simple while loop snorkytheweasel Linux - Newbie 8 03-28-2008 05:09 PM
Trouble With FOR Loop In Simple Bash Script sudleyplace Linux - Newbie 7 03-12-2008 04:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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