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
How to find files whose case is unknown mitkapadia UNIX for Dummies Questions & Answers 3 04-11-2008 05:55 AM
How to find a text in jar and zip files.?? redlotus72 UNIX for Dummies Questions & Answers 1 03-07-2006 08:29 AM
text files, ASCII files, binary files and ftp transfers Perderabo Answers to Frequently Asked Questions 0 04-08-2004 04:25 PM
grep multiple text files in folder into 1 text file? coppertone UNIX for Dummies Questions & Answers 7 08-23-2002 02:50 PM
Find files containing text sushrut UNIX for Dummies Questions & Answers 5 11-16-2001 10:28 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 04-14-2006
schipper schipper is offline
Registered User
  
 

Join Date: Apr 2006
Posts: 2
find files where text case is different

I need to search a directory for files that have certain text in the file name. I use the following command to do that successfully -

find /abc/indicator -name '*midday*.ind'

The problem is some file names are lower case, some mixed case and some upper case. Is there a way to do the find so case doesn't matter?

Also, I need perform some processing if I find files with certain text, otherwise I do other processing. Does the find command return a value that I can use for conditional processing?

Thanks for any help!
  #2 (permalink)  
Old 04-14-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,754
Code:
find /abc/indicator -print | grep  -i  '.*midday.*\.ind'
The -i tells grep to ignore case, the regex is grep's version of your wildcard match for files.
  #3 (permalink)  
Old 04-14-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,754
As to your second question - what is it you're looking for? Give examples.
  #4 (permalink)  
Old 04-25-2006
schipper schipper is offline
Registered User
  
 

Join Date: Apr 2006
Posts: 2
I need to perform something like the following

if there is a file with midday in the name
perform the following commands
else
perform these commands
end if

Using the following command - find /home/m088267 -print | grep -i '.*midday.*\.ind' to check for certain files, how do I code the if statement to know what processing to do?

Thanks for the help!
  #5 (permalink)  
Old 04-25-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Quote:
Originally Posted by schipper
find /home/m088267 -print | grep -i '.*midday.*\.ind'
Wouldnt this find help ?

Code:
find /home/m088267 -iname "*midday*.ind"
  #6 (permalink)  
Old 04-26-2006
thestevew thestevew is offline
Registered User
  
 

Join Date: Mar 2006
Location: South Yorkshire, UK
Posts: 114
-iname looks like a useful find expression, but it's missing from AIX
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 01:05 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