find files where text case is different


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find files where text case is different
# 1  
Old 04-14-2006
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  
Old 04-14-2006
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  
Old 04-14-2006
As to your second question - what is it you're looking for? Give examples.
# 4  
Old 04-25-2006
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  
Old 04-25-2006
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  
Old 04-26-2006
-iname looks like a useful find expression, but it's missing from AIX Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find text that is different in two files

In the attached files, I am trying to use import.txt to find what is missing in all.txt and print the missing lines in missing.txt. I used SQL to import a list into a database and got errors and need to figure out what didn't import correctly. The below script is close, I think, but doesn't... (8 Replies)
Discussion started by: cmccabe
8 Replies

2. Linux

Search only text files with 'find' command?

I've been using this to search an entire directory recursively for a specific phrase in my code (html, css, php, javascript, etc.): find dir_name -type f -exec grep -l "phrase" {} \; The problem is that it searches ALL files in the directory 'dir_name', even binary ones such as large JPEG... (2 Replies)
Discussion started by: Collider
2 Replies

3. UNIX for Dummies Questions & Answers

How to use wild cards to find files beginning with upper and lower case

Im trying to use wild cards to find files that start with either an upper or lower case letter e.g. list files that beginning with b or B, i also want to sort them by the time they were last modified. e.g latest file created first. At the moment i have the following code that ls -d... (3 Replies)
Discussion started by: parker4001
3 Replies

4. Shell Programming and Scripting

Find and replace using 2 text files as arrays.

Here's the nonfunctional code I have so far #!/bin/bash searchFor=(`cat filea.txt` ) replaceWith=(`cat fileb.txt`) myMax=${#searchFor} myCounter=1 while ; do sed -i 's/${$searchFor}/${$replaceWith}/g' done The goal is to use each line in filea.txt as a search term, and each line... (2 Replies)
Discussion started by: Erulisseuiin
2 Replies

5. Shell Programming and Scripting

How to find text in files without using the word itself but the assigned variable of it

I'm having a problem how to find the specific word in a file without using the word itself as a search but using the assigned variable which is the $passwd.. what command should I use to find the value of $passwd written in different script? how do I use the command to print the value in this... (7 Replies)
Discussion started by: jenimesh19
7 Replies

6. Shell Programming and Scripting

Find and add/replace text in text files

Hi. I would like to have experts help on below action. I have text files in which page nubmers exists in form like PAGE : 1 PAGE : 2 PAGE : 3 and so on there is other text too. I would like to know is it possible to check the last occurance of Page... (6 Replies)
Discussion started by: lodhi1978
6 Replies

7. UNIX for Dummies Questions & Answers

How to find files whose case is unknown

Hello experts, can you kindly tell me how I can look for a file in unix whose name may contain upper or lowercase letters? E.g. If I know the file contains the name netcool but unsure if its NETCOOL or netcool? Thanks :) (3 Replies)
Discussion started by: mitkapadia
3 Replies

8. UNIX for Dummies Questions & Answers

How to find a text in jar and zip files.??

Hi, I have classes dir, in that I have jar and zip files, I need to find "Param.class" is in which zip or jar file? (1 Reply)
Discussion started by: redlotus72
1 Replies

9. UNIX for Dummies Questions & Answers

Find files containing text

How do I find the files containing some text. eg. I want to find alll the files that contain the word 'hello' grep hello * will give me only for the specific directory. How do I find for entire system. Thanks for help in advance.. (5 Replies)
Discussion started by: sushrut
5 Replies
Login or Register to Ask a Question