find

Find Non-UTF8 Filenames on Linux File System

Hi, O/S = Fedora Code 9. I have a number of files hiding in my LANG=en_US:UTF-8 filesystem that have been uploaded with unrecognisable characters in their filename. I need to search the filesystem and return all filenames that have at least one character that is not in the standard range (a-zA-Z0-9 and .-_ etc.) I have been trying t...

Is it possible to speed up a recursive file scan in PHP?

I've been trying to replicate Gnu Find ("find .") in PHP, but it seems impossible to get even close to its speed. The PHP implementations use at least twice the time of Find. Are there faster ways of doing this with PHP? EDIT: I added a code example using the SPL implementation -- its performance is equal to the iterative approach ED...

WPF ways to find controls

I am trying to collect all possible ways to find controls in WPF. To find control by name, by type, etc. ...

In Mac OSX 10.5, it can't find my Terminal commands sudo, find, etc.

I don't know what has happened, but in my Terminal on Mac OSX 10.5 it can no longer find my sudo command, or find command, etc. They are there because if I put /usr/bin/sudo or /usr/bin/find it works fine... My .bash_login file looks like this: export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin$PATH" My .bash_pro...

grouping predicates in find

This part " ( -name *txt -o -name *html ) " confuses me in the code: find $HOME \( -name \*txt -o -name \*html \) -print0 | xargs -0 grep -li vpn Can someone explain the the brackets and "-o"? Is "-o" a command or a parameter? I know the brackets are escaped by "\" , but why are they for? ...

Unable to find Applications folder in Mac's terminal

I tried the following code unsuccessfully find Applications | xargs -0 grep Applications I also tried the following unsuccessfully find Applications ...

What is fastest children() or find() in jQuery?

To select a child node in jQuery one can use children() but also find(). For example: $(this).children('.foo'); gives the same result as: $(this).find('.foo'); Now, which option is fastest or preferred and why? ...

How can you recursively copy all of the *.foo files in src to target using cp and/or find?

cp -v -ur path/to/jsps/ /dest/path/ The above command copies all of the files that have been updated from the source directory to the destination, preserving the directory structure. What I can't figure out is how to copy only *.someExtention files. I know that you can use something like: find -f -name *.jsp -exec some awesome comman...

Rails: How do I find() all records unique in certain fields?

I have a list of 'request' objects, each of which has fairly normal activerecord qualities. The requests table is related to the games table with a join table, 'games_requests,' so that a request has a request.games array. The question is, is there a way to do a find for the last n unique requests, where uniqueness is defined by the ga...

Why doesn't my 'find' work like I expect using -exec?

I'm trying to remove all the .svn directories from a working directory. I thought I would just use find and rm like this: find . -iname .svn -exec 'rm -rf {}' \; But the result is: find: rm -rf ./src/.svn: No such file or directory Obviously the file exists, or find wouldn't find it... What am I missing? ...

Unable to understand the syntax of the command find

The find command seems to differ from other Unix commands. Why is there the empty curly brackets and a backward flash at the end of the following command? find * -perm 777 -exec chmod 770 {} \; I found one reason for the curly brackets but not for the backward flash. The curly brackets are apparently for the path Same as -exec,...

How to search a List(Of Byte) for two values using the Framework?

Is there a way of searching a list for more that one consecutive values? I've looking at Find and IndexOf but Find uses Predicates that only use the current value and IndexOf only takes byte parameters. I can code my own solution but I want to be sure that there isn't a solution already available to this common problem. Thanks in advan...

Examples for string find in Python

I am trying to find some examples but no luck. Anyone knows some examples on the net? I want to know what it returns when it can't find, and how to specify from start to end, which I guess is gonna be 0, -1. ...

Batch script to replace PHP short open tags with <?php

Hello everyone, I have a large collection of php files written over the years and I need to properly replace all the short open tags into proper explicit open tags. change "<?" into "<?php" I think this regular expression will properly select them : <\?(\s|\n|\t|[^a-zA-Z]) which takes care of cases like <?// <?/* but I am not s...

C++ const std::map reference fails to compile

Is there a reason why passing a reference to a STL map as const causes the [] operator to break? I get this compiler error (gcc 4.2) when I use const: error: no match for ‘operator[]’ in ‘map[name]’ Here's the function prototype: void func(const char ch, std::string &str, const std::map<std::string, std::string> &map); And, I ...

Applying Unix's Head on AWK Through Find Command

I want to output top 10 lines of AWK command in the list of files given by find, using this snippet: $ find . -name "*.txt" -print -exec awk '$9 != ""' \| head -n10 {} \; Note also that I want to print out the file names being processed. But why I get such error: awk: cmd. line:2: fatal: cannot open file `|' for reading (No such fi...

How can I verify that a value is present in an array (list) in Perl?

I have a list of possible values: @a = qw(foo bar baz); How do I check in a concise way that a value $val is present or absent in @a? An obvious implementation is to loop over the list, but I am sure TMTOWTDI. Thanks to all who answered! The three answers I would like to highlight are: The accepted answer - the most "built-in" ...

using find command to search for all files having some text pattern

Hi, I use following find command to find and show all files having the input text pattern. find . -type f -print|xargs grep -n "pattern" I have many project folders each of which has its own makefile named as 'Makefile'.(no file extension, just 'Makefile') How do i use above command to search for a certain pattern only in the files ...

C# - Search Binary File for a Pattern

What is the best way to search a large binary file for a certain substring in C#? To provide some specifics, I'm trying to extract the DWARF information from an executable, so I only care about certain parts of the binary file (namely the sections starting with the strings .debug_info, .debug_abbrev, etc.) I don't see anything obvious ...

Why does Mac's $find not have the option -printf?

I have not found a reason why Mac's find does not have the option -printf. Apple normally decides to take options out which are not orthogonal to the other commands? How can you reach the same result as the following command in Mac without coreutils? find . -printf "%i \n" // command in Ubuntu ...