The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Operating Systems > Linux
.
google unix.com



Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
grep with regular expression optional value necroman08 Shell Programming and Scripting 11 10-05-2009 10:03 AM
grep regular expression Calypso Shell Programming and Scripting 7 05-18-2009 08:08 AM
grep with regular expression daikeyang Shell Programming and Scripting 6 03-22-2009 08:46 PM
regarding grep regular expression ukatru UNIX for Advanced & Expert Users 2 10-23-2008 12:47 AM
grep : regular expression RishiPahuja Shell Programming and Scripting 10 09-13-2005 01:53 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-27-2009
sogi sogi is offline
Registered User
  
 

Join Date: May 2009
Posts: 21
mark54g:
Could it be that grep is limited to certain line numbers. When I had close to 1/2 million columns I did not have a problem. BUT, now that I have that many rows, grep does not seem to work.


treedroppings:
Yes I have tried the man pages since I know very little about unix.
  #2 (permalink)  
Old 09-27-2009
apsprabhu apsprabhu is offline
Registered User
  
 

Join Date: Feb 2008
Location: India
Posts: 45
why don't you use the below code,

for line in `cat file1`
do
grep -w "$line" file2 >>file3
done
  #3 (permalink)  
Old 09-27-2009
mark54g mark54g is offline
Registered User
  
 

Join Date: May 2008
Posts: 366
Could you feed it to cat and then use xargs to append the file?
  #4 (permalink)  
Old 09-26-2009
mark54g mark54g is offline
Registered User
  
 

Join Date: May 2008
Posts: 366
Maybe this will work:


Code:
cat file1 | while read LINE
do
grep -e $LINE file2 >> file3
done

  #5 (permalink)  
Old 09-28-2009
sogi sogi is offline
Registered User
  
 

Join Date: May 2009
Posts: 21
mark54g and apsprabhu;

You were very helpful. THANK YOU!. This code works:


Code:
file="file1.txt"
while read line
do
grep $line file2 >> file3
done < $file

Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0