The UNIX and Linux Forums  

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
Shell script to search for text in a file and copy file imeadows UNIX for Dummies Questions & Answers 9 11-12-2008 09:12 PM
how can search a String in one text file and replace the whole line in another file kkraja UNIX for Dummies Questions & Answers 6 08-06-2008 08:23 AM
search for the contents in many file and print that file using shell script cdfd123 Shell Programming and Scripting 3 10-07-2007 11:17 PM
Dowloading a File from FTP Server to a local Server where User Id's are different ranjith_taurean Shell Programming and Scripting 1 02-22-2007 07:47 AM
How to search a pattern inside a zipped file ie (.gz file) with out unzipping it senraj01 Shell Programming and Scripting 2 04-26-2006 05:32 AM

Closed Thread
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 12-09-2008
venkidhadha venkidhadha is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 19
Search for a particular file in the server

I need to search for a particular file pattern in the whole server. In windows we just get into start and then click on search and find the file.

How will search for the particular pattern of file in the whole server. let me know about it.
I tried using the find command will that help or is there any other command which willhelp this purpose.
  #2 (permalink)  
Old 12-09-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,311
find was a good idea. You could just test it by searching a file you know it exist.

Code:
find / -type f -name "yourfilename" -print

  #3 (permalink)  
Old 12-09-2008
iamgeethuj iamgeethuj is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 38
Could u plz give me an example?
  #4 (permalink)  
Old 12-09-2008
venkidhadha venkidhadha is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 19
For Example if my file patter is abc.lvc.* Can you let me know how i can implement the command for this ?
  #5 (permalink)  
Old 12-09-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Cool Format(s)


Code:
find . -name abc.lvc.* -print

Will find files from you current directory and all sub-directories beneath it.


Code:
find / -name abc.lvc.* -print

Will search the entire system for the files. Will take a while, and you may see errors that you do not have access to view directories.

Last edited by joeyg; 12-09-2008 at 12:06 PM..
  #6 (permalink)  
Old 12-09-2008
venkidhadha venkidhadha is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 19
Thanks.
  #7 (permalink)  
Old 12-09-2008
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,184
In unix but not Windows a fullstop can mean any character or characters. It needs to be escaped with a preceding back solidus. Also you want asterisk expanded by find and not by shell.
If directories are linked at root level you will need "//" rather than "/".

find // -name abc\.lvc\.\* -print
Closed Thread

Bookmarks

Tags
shell script, shell scripting, unix scripting, unix scripting basics

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 02:14 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