Questions tagged [find]
This tag has multiple meanings. Please DO NOT use this tag if you're just trying to find something.
find
1,049
questions
302
votes
22
answers
407k
views
How can I find WPF controls by name or type?
I need to search a WPF control hierarchy for controls that match a given name or type. How can I do this?
421
votes
18
answers
462k
views
How to loop through file names returned by find?
x=$(find . -name "*.txt")
echo $x
if I run the above piece of code in Bash shell, what I get is a string containing several file names separated by blank, not a list.
Of course, I can further ...
2219
votes
49
answers
1.8m
views
How do I exclude a directory when using `find`?
How do I exclude a specific directory when searching for *.js files using find?
find . -name '*.js'
7538
votes
56
answers
11.2m
views
Find all files containing a specific text (string) on Linux?
How do I find all files containing a specific string of text within their file contents?
The following doesn't work. It seems to display every single file in the system.
find / -type f -exec grep -H '...
414
votes
8
answers
499k
views
How can I find elements by text content with jQuery?
Can anyone tell me if it's possible to find an element based on its content rather than by an ID or class?
I am attempting to find elements that don't have distinct classes or IDs. (Then I then need ...
941
votes
14
answers
3.3m
views
Find a value in a list [duplicate]
I use the following to check if item is in my_list:
if item in my_list:
print("Desired item is in list")
Is "if item in my_list:" the most "pythonic" way of finding ...
171
votes
9
answers
167k
views
How can I store the "find" command results as an array in Bash
I am trying to save the result from find as arrays.
Here is my code:
#!/bin/bash
echo "input : "
read input
echo "searching file with this pattern '${input}' under present directory"
array=`find . -...
412
votes
13
answers
267k
views
Fast way of finding lines in one file that are not in another?
I have two large files (sets of filenames). Roughly 30.000 lines in each file. I am trying to find a fast way of finding lines in file1 that are not present in file2.
For example, if this is file1:
...
169
votes
13
answers
167k
views
How can I search for a multiline pattern in a file?
I needed to find all the files that contained a specific string pattern. The first solution that comes to mind is using find piped with xargs grep:
find . -iname '*.py' | xargs grep -e 'YOUR_PATTERN'
...
183
votes
13
answers
124k
views
Python ElementTree module: How to ignore the namespace of XML files to locate matching element when using the method "find", "findall"
I want to use the method of findall to locate some elements of the source xml file in the ElementTree module.
However, the source xml file (test.xml) has namespaces. I truncate part of xml file as ...
436
votes
9
answers
642k
views
How to use regex with find command?
I have some images named with generated uuid1 string. For example 81397018-b84a-11e0-9d2a-001b77dc0bed.jpg. I want to find out all these images using "find" command:
find . -regex "[a-...
139
votes
6
answers
1.8m
views
FileNotFoundError: [Errno 2] No such file or directory [duplicate]
I am trying to open a CSV file but for some reason python cannot locate it.
Here is my code (it's just a simple code but I cannot solve the problem):
import csv
with open('address.csv','r') as f:
...
82
votes
13
answers
62k
views
Capturing output of find . -print0 into a bash array
Using find . -print0 seems to be the only safe way of obtaining a list of files in bash due to the possibility of filenames containing spaces, newlines, quotation marks etc.
However, I'm having a ...
2
votes
1
answer
887
views
Test if array is inside a list in lisp
I have two items. The first, a-child, is a list which contains an array as its first element and then some strings as the remaining elements. The other, mapped, is a list which contains a number of ...
222
votes
8
answers
696k
views
How can I check if character in a string is a letter? (Python)
I know about islower and isupper, but can you check whether or not that character is a letter?
For Example:
>>> s = 'abcdefg'
>>> s2 = '123abcd'
>>> s3 = 'abcDEFG'
>>&...