Grep alternative to handle large numbers of files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Grep alternative to handle large numbers of files
# 1  
Old 02-18-2009
Grep alternative to handle large numbers of files

I am looking for a file with 'MCR0000000716214' in it. I tried the following command:

grep MCR0000000716214 *

The problem is that the folder I am searching in has over 87000 files and I am getting the following:

bash: /bin/grep: Arg list too long

Is there any command I can use that can handle the large number of files?
# 2  
Old 02-18-2009
what is 'folder'?
look into 'man find' and 'man xargs'

Last edited by vgersh99; 02-18-2009 at 08:09 AM..
# 3  
Old 02-18-2009
find . -name MCR0000000716214
# 4  
Old 02-18-2009
Quote:
Originally Posted by taran
find . -name MCR0000000716214

Does this not just look for a file with that name in it?
# 5  
Old 02-18-2009
Quote:
Originally Posted by vgersh99
what is 'folder'?
Apologies I meant directory.
# 6  
Old 02-18-2009
if he means looking for this string in a huge number of files....

then this'll work:

Code:
find . -type f -exec grep MCR0000000716214 {} \; -print

if he means finding a file with that string in the file name itself...

Code:
/bin/ls *MCR0000000716214*

# 7  
Old 02-18-2009
however, if he doesn't want to do a recursive directory search . . .
he might try:

Code:
/bin/ls |
while read file ; do

  grep MCR0000000716214 $file /dev/null

done

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parse for 2 numbers in large single line

Hi All, I am writing a script in which I need to gather 2 numbers for 'total' and 'successful'. The goal is to compare the two numbers and if they are not equal, rerun the task until all are successful. I'm thinking the best way will be with awk or sed, but I really don't know where to begin... (8 Replies)
Discussion started by: hburnswell
8 Replies

2. Shell Programming and Scripting

Help with grep, or alternative

say I have a big list of something like: sdg2000 weghre10 fewg53 gwg99 jwegwejjwej43 afg10293 I want to remove the numbers of any line that has letters + 1 to 4 numbers output: sdg weghre fewg gwg jwegwejjwej afg10293 (7 Replies)
Discussion started by: Siwon
7 Replies

3. Shell Programming and Scripting

Adding Long List Of Large Numbers

Hi All, I have a file with long list of numbers. This file contains only one column. These numbers are very large. I am using following command: cat myfile.txt | awk '{ sum+=$1} END {print sum}' The output is coming in scientific notation. How do I get the result in proper format? ... (4 Replies)
Discussion started by: angshuman
4 Replies

4. UNIX for Dummies Questions & Answers

Find common numbers from two very large files using awk or the like

I've got two files that each contain a 16-digit number in positions 1-16. The first file has 63,120 entries all sorted numerically. The second file has 142,479 entries, also sorted numerically. I want to read through each file and output the entries that appear in both. So far I've had no... (13 Replies)
Discussion started by: Scottie1954
13 Replies

5. Programming

Working with extremely large numbers in C

Hi All, I am just curious, not programming anything of my own. I know there are libraries like gmp which does all such things. But I really need to know HOW they do all such things i.e. working with extremely large unimaginable numbers which are beyond the integer limit. They can do add,... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

6. Shell Programming and Scripting

Need best grep option or alternative

Hello, I am processing a text file which contains only words with few combination of characters (it is a dictionary file). example: havana have haven haven't havilland havoc Is there a way to exclude only 1 to 8 character long words which not include space or special characters : '-`~.. so... (5 Replies)
Discussion started by: alekkz
5 Replies

7. Shell Programming and Scripting

Alternative to grep

How to find a particular line in a file without using grep? (3 Replies)
Discussion started by: proactiveaditya
3 Replies

8. UNIX for Dummies Questions & Answers

grep to handle a 0 result

Hi guys, I have the following grep command in a script to search through a file for a string and return its count, and it works fine for when the string exists: grep "string" file.txt | wc However, sometimes the result will be 0 and I want the script to take this as the result. Right now... (6 Replies)
Discussion started by: ocelot
6 Replies

9. Shell Programming and Scripting

How to parse large numbers of shell scripts

I am trying to parse hundreds of shell scripts to determine how they related to each other. Ideally for every script, I would get an output of: What other scripts it calls What files it reads Environment variables it accesses Any ideas on how to do this? TIA! (2 Replies)
Discussion started by: bliss
2 Replies
Login or Register to Ask a Question