The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help with finding & replacing pattern in a file dusoo Shell Programming and Scripting 0 05-23-2008 03:59 AM
finding duplicate files by size and finding pattern matching and its count jerome Sukumar Shell Programming and Scripting 2 12-01-2006 04:20 AM
trnsmiting thousands ftp files and get an error message alexcol Shell Programming and Scripting 3 09-27-2006 09:58 PM
Breaking output for specific pattern shoeb_syed UNIX for Dummies Questions & Answers 2 03-08-2006 04:00 AM
to separate a specific pattern shriashishpatil Shell Programming and Scripting 11 03-06-2006 08:04 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-17-2006
aarora_98 aarora_98 is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 33
Finding a specific pattern from thousands of files ????

Hi All,

I want to find a specific pattern from approximately 400000 files on solaris platform. Its very heavy for me to grep that pattern to each file individually.

Can anybody suggest me some way to search for specific pattern (alpha numeric) from these forty thousand files. Please note that out of 40000 files only few files has this specific pattern.

I would really be greatful. This really can make my work easy.

Thanks,
Aru
  #2 (permalink)  
Old 02-17-2006
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
one way i could think of is to run multiple instance of grep together dividing the number of files to each of the instance.

If you are running it in live env take care of the no of instance, the load your system could take on
  #3 (permalink)  
Old 02-17-2006
shriashishpatil shriashishpatil is offline
Registered User
  
 

Join Date: Dec 2005
Location: Pune
Posts: 81
Try to use find command coupled with -exec option.
If you know the pattern of filenames you can narrow down no. of files to be searched
with wild card characters.
  #4 (permalink)  
Old 02-17-2006
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
Quote:
Originally Posted by shriashishpatil
Try to use find command coupled with -exec option.
If you know the pattern of filenames you can narrow down no. of files to be searched
with wild card characters.
request was to search for a pattern within the file and the user is not sure of the file pattern which contain the search pattern
only input is the filenames and the pattern to be searched within the file

moreover find with exec is not an effective way for large runs
use find piped to xargs
  #5 (permalink)  
Old 02-17-2006
aarora_98 aarora_98 is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 33
Ya matrixmadhan...... you are right . I am not sure which files out of those 40000 file contains a search pattern..

suppose that I have files 1x,2x,3x........,40000x .
So, how are you going to use find piped to xargs , say to search pattern "N1cd56" in the above 40000 files.

please tell me the usage.

Thanks,
Aru
  #6 (permalink)  
Old 02-17-2006
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
that was just a comparison what i said about exec with find and xargs with find

suggested was:
instance 1:
for files in <file 1... file10000>
do
grep <pattern> files
done

instance 2:
for files in <file 10001... file20000>
do
grep <pattern> files
done

similarly for instance 3 and 4.
you can just have list of filenames in a particular file and just furnish the required filenames (file 1.. file 10000) to each of the instance

hope i am clear
  #7 (permalink)  
Old 02-17-2006
aarora_98 aarora_98 is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 33
Let me try once......

Thnx.
Aru
Sponsored Links
Closed Thread

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:24 AM.


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