06-23-2002
find function
I was trying the following "find" command to search for a particular file in UNIX directories:
find / -name <filename> -print
Result on the screen appears like:
find: cannot open <..>
..permission denied
Is there any way, I could avoid these type of search results and only see the correct file?
Cheers,
Pravin Kumar
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi, I have a task to search for a file called 'Xstartup' in the whole system because there might be different versions of it which overrite eachother.
Can anyone suggest a smart command to run this search ? The machine needs to scan every single folder beginning from root.
Please help, I am... (5 Replies)
Discussion started by: DGoubine
5 Replies
2. Shell Programming and Scripting
hi,
i am a newbie and have to write a rather complicated script. Assume that i have a variable called x and a C source code file say file1.c (these are the inputs of the script) and i need to find the names of all the functions in the C file containing x.Take the following code as an example:
... (2 Replies)
Discussion started by: samantha grace
2 Replies
3. Shell Programming and Scripting
Hi,
Im using a find function to find a specific file and print it.
eg.
find /path -name filename -type f -print -exec more '{}' \;
The problem I have is that I need to know if the file has not been fount (ie it does not exist).
I had a look at the find function and could not find anything... (4 Replies)
Discussion started by: strobo
4 Replies
4. Shell Programming and Scripting
I have an error in my logs as it shows some function name .
1. I dnt know where is the file.cpp located only i know the machine .
2. How to find out that the function name is loacated in which path and which file into that machine.
Thanks . (1 Reply)
Discussion started by: madfox
1 Replies
5. Shell Programming and Scripting
Hello All,
Is there any way to find a function name in a program file using perl.
for example, there is a file called Test.C in that
.
.
void function1(..)
{
<some code>
}
int function2(..)
{
.
.
sam() /*RA abc100*/
...
..
..
xyz()/*RA abc201*/
.. (8 Replies)
Discussion started by: Parthiban
8 Replies
6. Shell Programming and Scripting
Hi,
I need to use a function in the find command to do some process on the file. I'm trying:
funcname(){ ... }
...
find ./ -name "*" -exec funcname {} \;
But somehow this is not working. I don't want to have a separate script for whatever processing the function does. I want to have... (1 Reply)
Discussion started by: victorcheung
1 Replies
7. Shell Programming and Scripting
Hello,
I'm learning the perl's Find function using unix but I keep getting this error when running the script:
"Not a CODE reference at /usr/lib.perl5/5.8.8/File/Find.pm line 822" - what does this mean?
Does anyone know??? Here's my script:
use File::Find;
find (\$dir,$ENV{HOME});
... (4 Replies)
Discussion started by: new bie
4 Replies
8. Shell Programming and Scripting
I am writing a bash script in which I am using the find command to find files, and then I'd like to send the output to a function (in the same script) that will process those results (such as test if the file is an image, and other things).
However, try as I might, I can't get the function to... (6 Replies)
Discussion started by: twjolson
6 Replies
9. Shell Programming and Scripting
Hi,
There is requirement where I need to search if a particular directory name is present or not and if its present I need to collate the paths of the directories in a file.
I tried the below command
echo $(find /home/mqm -name "check")>>config.txt
Its saving the paths in one line(like... (7 Replies)
Discussion started by: jayii
7 Replies
10. Shell Programming and Scripting
Hi everybody,
I want your help on what, I suppose, might seem a simple task to many of you.
the deal is to write a script that will look in a specific folder to see if there is any file whose size is bigger than say 1M and if so to execute a command.
like
if
then
log_rotate
fi
... (3 Replies)
Discussion started by: lenci_xc
3 Replies
LEARN ABOUT DEBIAN
ftwhich
FTWHICH(1) General Commands Manual FTWHICH(1)
NAME
ftwhich - fault tolerant search for a command name
SYNOPSIS
ftwhich [-#hIp][-t#] program_name
DESCRIPTION
ftwhich is a fault tolerant version of the which(1) command. ftwhich searches for a given program in all directories included in your PATH
environment variable and reports all files with a name that approximately matches the given program_name.
ftwhich achieves fault tolerance by calculating the so called Weighted Levenshtein Distance. The Levenshtein Distance is defined as the
minimum number of character insertions, deletions and replacements that transform a string A into a string B.
ftwhich is similar to the which command with the following differences:
- ftwhich is by default NOT case sensitive
- ftwhich is fault tolerant
- Some shells have a build in which command that will also search aliases. ftwhich can naturally not search for aliases as it does
not know about alias definitions.
- ftwhich lists all files that approximately match. The files first shown take preference over files of the same name printed later as
they are from directories listed earlier in the PATH.
- The level of fault tolerance can be adjusted by specifying the optional parameter tolerance. A tolerance of 0 specifies exact
match.
OPTIONS
-h Prints help/usage information.
-I Do case sensitive search (default is case in-sensitive)
-p print the actual distance value in front of the found filename. This value is equal to the number of insertions, deletions and
replacements necessary to transform the name of the found program into the search key.
-# or -t#
Set the fault tolerance level to #. The fault tolerance level is an integer in the range 0-255. It specifies the maximum number of
errors permitted in finding the approximate match. The default tolerance is (strlen(searchpattern) - number of wildcards)/6 + 1
program_name
The program file to search for. '*' and '?' can be used as wildcards.
'?' denotes one single character.
'*' denotes an arbitrary number of characters.
The last argument to ftwhich is not parsed for options as the program needs at least one program_name argument. This means that ftwhich -x
will not complain about a wrong option but search for the program named -x.
EXAMPLE
Search for all programs like gcc in your PATH:
ftwhich gcc
This will e.g. find gcc or cc or CC ...
To find all files that start with any prefix and end in config and differ in 2 letters from the word config:
ftwhich -2 '*config'
To find all files that exactly start with the prefix if:
ftwhich -0 'if*'
To find all clock programs:
ftwhich -0 '*clock*'
BUGS
The wildcards '?' and '*' can not be escaped. These characters function always as wildcards. This is however not a big problem since there
is normally hardly any command that has these characters in its name.
AUTHOR
Guido Socher (guido@linuxfocus.org)
SEE ALSO
whichman(1), ftff(1)
Search utilities January 1999 FTWHICH(1)