bash: find multiple types[solved]


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting bash: find multiple types[solved]
# 1  
Old 02-03-2012
bash: find multiple types[solved]

Hi,

I would like to use find to search for multiple types. For example search for symlink and regular file but not directories, sockets etc.... Something like:

Code:
find . -type l,f -name "stuff"

But of course it does not work.
Is there any way to avoid an if statement and to do it faster?

I searched the forum but I found something related to multiple file name (extension) but not type.

Thanks in advance

D.

---------- Post updated at 12:20 PM ---------- Previous update was at 12:17 PM ----------

==========================
OK Sorry I got it

Code:
find . -type f -o -type l -name "stuff"

it seems to work.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Script to find file types and info

I'm looking for a way to inventory files on a webserver into a CSV file, and am particularly interested in certain types of files, like .php, .cgi, .pl, .py, .sh, etc. but also want the ability to find all files, including those with no extension, or specified extensions, as above, including files... (1 Reply)
Discussion started by: spacegoose
1 Replies

2. Shell Programming and Scripting

Using a single "find" cmd to search for multiple file types and output individual files

Hi All, I am new here but I have a scripting question that I can't seem to figure out with the "find" cmd. What I am trying to do is to only have to run a single find cmd parsing the directories and output the different file types to induvidual files and I have been running into problems.... (3 Replies)
Discussion started by: swaters
3 Replies

3. Shell Programming and Scripting

Bash enumerated types

I have a variable, vbLevel and want to assign it to one of several values which are "none", "low", "medium", "high". Then I want to do something like if ; then ... fi (9 Replies)
Discussion started by: kristinu
9 Replies

4. UNIX for Dummies Questions & Answers

How to find the partition types in linux

How do we find the partition type in Linux? df -T will give me the mounted partition types like ufs, ext3 etc. How do I find out for say a newly added disk to the system? Please advise... Thanks (2 Replies)
Discussion started by: lubu
2 Replies

5. Shell Programming and Scripting

How to pass multiple file types search pattern as argument to find?

How can I pass $var_find variable as argment to find command? test.sh var_find=' \( -name "*.xml" -o -name "*.jsp" \) ' echo "${var_find}" find . -type f ${var_find} -print # Below statement works fine.. I want to replace this with the above.. #find . \( -name "*.xml" -o -name... (4 Replies)
Discussion started by: kchinnam
4 Replies

6. Linux

Simplified find command to find multiple file types

Hi, I'm using the following command to find the multiple requierd file types and its working fine find . -name "*.pl" -o -name "*.pm" -o -name "*.sql" -o -name "*.so" -o -name "*.sh" -o -name "*.java" -o -name "*.class" -o -name "*.jar" -o -name "*.gz" -o -name "*.Z" -type f Though... (2 Replies)
Discussion started by: vickramshetty
2 Replies

7. Shell Programming and Scripting

flexible sed command needed to handle multiple input types

Hello, I need a smart sed command that can take any of the following two as an input and give below mentioned output. As you can see, I am trying to convert some C code INPUT: struct abc_sample1 { char myString; UINT16 myValue1; ... (2 Replies)
Discussion started by: SiftinDotCom
2 Replies

8. Shell Programming and Scripting

find multiple file types and tar

There are these ksh files and config files that are written and updated on a daily basis. All I want to do is write a script that finds both these types of files and archive them on a daily basis, to help in restoring in times of system outages and so on. Particulary I'm interested in .ksh ,... (9 Replies)
Discussion started by: manthasirisha
9 Replies

9. UNIX for Dummies Questions & Answers

find directory with 2 types of files

Trying to use the find command to find any directory which contains a file ending in .zip AND a file ending in .o I'm having trouble specifying multiple files as criteria and have can't seem to figure it out from Unix in a Nutshell and Google. (2 Replies)
Discussion started by: dangral
2 Replies
Login or Register to Ask a Question
whereis(1)						      General Commands Manual							whereis(1)

NAME
whereis - Locates files for programs SYNOPSIS
whereis [-bms] [-u] [-BMS directory... -f] program... The whereis command locates source, binary, and/or reference page files for the specified program program. OPTIONS
The -b, -m, and -s options can be used in combination to restrict the search. Searches for an executable program. Searches for the refer- ence page for a program. Searches for the sources of a program. Use the -B, -M, and -S options to change or limit the places whereis searches. Specifies the binary directories to search. Specifies the reference page directories to search. Specifies the source directories to search. The other options that can be used with whereis are as follows: Terminates the last directory list and signals the start of program names. Used with other options to indicate when there is no file for program in the default or specified directory or directories (source, binary, or reference page). DESCRIPTION
The whereis program locates source, binary, and reference pages for the specified programs. When looking for a match, the program names are stripped of leading pathname components and any trailing extensions of the form (for example, s. resulting from the use of the Source Code Control System see sccs(1), are also handled. The default directories searched by the whereis command are as follows: /etc /etc/nls /sbin /usr/bin /usr/lbin /usr/lbin/spell /usr/ccs/lib /usr/lib /usr/local /usr/hosts /usr/sbin EXAMPLES
To find files matching cat in the default source, binary, and reference directories, enter: whereis cat To search for reference pages for app13 in the directory /usr/local/man, enter: whereis -M /usr/local/man -f -f appl3 To find the programs in /usr/bin that do not have ref- erence pages in /usr/share/man/man1 with source files in /usr/src/cmd, enter: whereis -u -M /usr/share/man/man1 -S /usr/src/cmd -f /usr/bin/* To find which files in the current directory either have no reference pages in the default reference directories or have more than one, enter: whereis -m -u * FILES
Default binary directories. Default binary directories. Default reference directories. Default source directories. SEE ALSO
Commands: apropos(1), find(1), man(1), which(1), catman(8) whereis(1)