Find command - using regular expr


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find command - using regular expr
# 1  
Old 06-03-2011
Find command - using regular expr

Hi, I would like to use find command to find file with a predefined extension
for example find . modules/*.ksh *.lib
I thought it's possible to use something like :
find . modules/*.[ksh|lib] but it does not work. is there any other way?

Thanks you
# 2  
Old 06-03-2011
try it out.

man find and search for the -o and -a

Code:
find . -name "*.ksh" -o "*.lib" -print

Code:
find . -type f \( -iname "*.ksh" -or -iname "*.lib" \) 

This User Gave Thanks to itkamaraj For This Post:
# 3  
Old 06-05-2011
Thank you very much itkamaraj. It works fine!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regular Expression in Find command [KSH]

Hello, I am trying to use regex wtih find command in KSH. For some reason it is not working as expected. Input: comm_000_abc_0102.c comm_000_abc.c 456_000_abc_1212.cpp 456_000_abc_.cpp Expected Output: comm_000_abc_0102.c kkm_000_abc_8888.cpp (Basically I want to find all... (6 Replies)
Discussion started by: vinay4889
6 Replies

2. Shell Programming and Scripting

Find, regular expression, anyway to simplify this find command?

Hello everyone, first post here, trying to learn scripting on my own and this forum as been really helpful so far. I made few little scripts working great but I m facing some problems with RE. I have a bunch of files in many subdirectories called *001.ext *002.ext OR simple *.ext or *01.ext... (7 Replies)
Discussion started by: Sekullos
7 Replies

3. Shell Programming and Scripting

expr command help

I'm trying to check if a variable'd string is only one character and use that in an if statement the only way I could find is: $expr "${var}" : . # expr STRING : regrep where the "." is the grep wildcard for any single character. Whats wrong with my code here and is there a... (3 Replies)
Discussion started by: Tewg
3 Replies

4. Shell Programming and Scripting

expr command

Hi Can anyone explain me the usage of this command and the arguments used here and what will be the expected output : v_num=`expr nav_d_20100204_1759 : '*\(*\)'` what will be the value returned in v_num. Thanks in Advance!!! Regards Naveen Purbia (3 Replies)
Discussion started by: trying_myluck
3 Replies

5. UNIX for Dummies Questions & Answers

using regular expression for directories in find command

Hi, I want to find the files available in a directory /var/user/*/*/data/. I tried using the command "find /var/user/ -path '*/*/data/ -name '*' -type f" it says find: 0652-017 -path is not a valid option and then i tried using "find /var/user/ -name '*/*/data/*' -type f" but its not... (3 Replies)
Discussion started by: vinothbabu12
3 Replies

6. Shell Programming and Scripting

how can i find sqrt of a any number without using expr

hi friends can any body tell me how can i find sqrt of a any given number without using expr in bash shell while i am doing i got some errors please take a look and code is here x=$((( ( sqrt($1) ) | bc ))) echo $x $ sh quadratic-eqn-roots.sh 9 quadratic-eqn-roots.sh: line 12: ( (... (6 Replies)
Discussion started by: srinivas2828
6 Replies

7. Shell Programming and Scripting

Find first digit in string using expr index

I have looked for hours for an answer, so I have decided to request your guidance. I want to substract the first number (series of digits) contained in a string. This string is the output of another command. The substring (number) can be located at any position inside the string. I want to... (4 Replies)
Discussion started by: jcd
4 Replies

8. UNIX for Dummies Questions & Answers

using the expr command

Hi friends how can i execute expr $va1 * $var2 provided i m not supposed to use '/' also the nglob variable is turned off. (4 Replies)
Discussion started by: ashishj
4 Replies

9. UNIX for Dummies Questions & Answers

expr command

hi guys.... i hava a command expr... where i m adding a value in a loop like Tc=`expr $Tc\+ $l` where Tc is declred as a variable and every time l contains a new vaue if Tc =0 initially and l =2 Tc should be equal to 0+ 2 and then l = 4 Tc = 2+4 and dispaly as 6 but after... (5 Replies)
Discussion started by: madhu_aqua14
5 Replies

10. UNIX for Dummies Questions & Answers

expr command

I am looking for the correct syntax on the expr command in UNIX. I have a script that I am building at the moment. the script is creating file1 that is an actual .sql file that is going inside the oracle database to get some information in there. It take that information, puts it inside another... (2 Replies)
Discussion started by: wolf
2 Replies
Login or Register to Ask a Question