- How To Do A Keyword Search
- Search For Keywords In Text
- Word Search On A Mac
- How To Search All Text On Mac For A Keywords
Active25 days ago
In Windows, I would have done a search for finding a word inside a folder. Similarly, I want to know if a specific word occurs inside a directory containing many sub-directories and files. My searches for grep syntax shows I must specify the filename, i.e.
grep string filename
.Home > PhoneRescue > PhoneRescue for iOS > How to Search Text Messages/iMessages on iPhone with 3 Simple Ways We send and receive messages everyday with the Messages App on the iPhone. Like many of us, you may find that it is not easy to search for a specific text among a pile of messages on your iPhone. I can't seem to find a way to do a keyword search on outlook express on a mac. If I type in a word in search or advanced search OE seems to look for thing with that word in it eg. If i search for emails with the word art in the title i will get back all subjects with the word art anywhere in a word like artwork or artful or artistic and even start. How to find files with certain text in the Terminal. Ask Question. Supposing you need to search for files containing text - 'async', recursively in current directory, you can do so in one of the ways like below. Browse other questions tagged macos mac unix terminal search or ask your own question. 8 years, 4 months ago. Supposing you need to search for files containing text - 'async', recursively in current directory, you can do so in one of the ways like below: Using grep Using ack.
Now, I do not know the filename, so what do I do?A friend suggested to do
MackMgrep -nr string
, but I don't know what this means and I got no results with it (there is no response until I issue a ctrl + c).2,01544 gold badges2424 silver badges3939 bronze badges
kikikiki5,9541515 gold badges4242 silver badges6161 bronze badges
12 Answers
The dot at the end searches the current directory. Meaning for each parameter:
How can i move around in text document in word for mac.
grep -nr 'MobileAppSer*' .
(Would find MobileAppServlet.java
or MobileAppServlet.class
or MobileAppServlet.txt
; 'MobileAppASer*.*'
is another way to do the same thing.)To check more parameters use man grep command.
Manish RanjanManish Ranjan7,56311 gold badge1212 silver badges2020 bronze badges
grep -nr string my_directory
Additional notes: this satisfies the syntax
grep [options] string filename
because in Unix-like systems, a directory is a kind of file (there is a term 'regular file' to specifically refer to entities that are called just 'files' in Windows).grep -nr string
reads the content to search from the standard input, that is why it just waits there for input from you, and stops doing so when you press ^C (it would stop on ^D as well, which is the key combination for end-of-file).5,70022 gold badges1818 silver badges3434 bronze badges
GREP: Global Regular Expression Print/Parser/Processor/Program.
You can use this to search the current directory.
You can specify -R for 'recursive', which means the program searches in all subfolders, and their subfolders, and their subfolder's subfolders, etc.
You can use this to search the current directory.
You can specify -R for 'recursive', which means the program searches in all subfolders, and their subfolders, and their subfolder's subfolders, etc.
-n
will print the line number, where it matched in the file.-i
will search case-insensitive (capital/non-capital letters).48.7k5757 gold badges285285 silver badges374374 bronze badges
There's also:
but that might be a bit much for a beginner.
find
is a general purpose directory walker/lister, -type f
means 'look for plain files rather than directories and named pipes and what have you', -print0
means 'print them on the standard output using null characters as delimiters'. The output from find
is sent to xargs -0
and that grabs its standard input in chunks (to avoid command line length limitations) using null characters as a record separator (rather than the standard newline) and the applies grep -li word
to each set of files. On the grep
, -l
means 'list the files that match' and -i
means 'case insensitive'; you can usually combine single character options so you'll see -li
more often than -l -i
.If you don't use
mu is too shortmu is too short-print0
and -0
then you'll run into problems with file names that contain spaces so using them is a good habit.363k5959 gold badges721721 silver badges695695 bronze badges
will do a RECURSIVE (meaning the directory and all it's sub-directories) search for the search_string. (as correctly answered by usta). Word for mac show hidden text.
The reason you were not getting any anwers with your friend's suggestion of:
is because no directory was specified. If you are in the directory that you want to do the search in, you have to do the following:
It is important to include the '.' character, as this tells grep to search THIS directory.
Nico HuysamenNico Huysamen7,62499 gold badges5050 silver badges7878 bronze badges
grep -r 'yourstring' *
Will find 'yourstring' in any files and folders
Now if you want to look for two different strings at the same time you can always use option E and add words for the search. example after the break
grep -rE 'yourstring|yourotherstring|$' *
will search for list locations whereyourstring
oryourotherstring
matches
96.9k2424 gold badges224224 silver badges306306 bronze badges
NwaogaNwaoga
Why not do a recursive search to find all instances in sub directories:
grep -r 'text' *
This works like a charm.
Saikat Sengupta3,40266 gold badges4646 silver badges7070 bronze badges
PaxwellPaxwell
Another option that I like to use:
-type f returns you only files and not folders
-exec and {} runs the grep on the files that were found in the search (the exact syntax is '-exec command {}').
jfhfhf839jfhfhf839
DimiDakDimiDak
The answer you selected is fine, and it works, but it isn't the correct way to do it, because:
This actually searches the string
'yourStrin'
and 'g'
0 or many times.So the proper way to do it is:
This command searches the string with any character before and after on the current folder.
eLRuLLeLRuLL13.5k77 gold badges5252 silver badges8383 bronze badges
How To Do A Keyword Search
Similar to the answer posted by @eLRuLL, a easier way to specify a search that respects word boundaries is to use the
Mike SlinnMike Slinn-w
option:Search For Keywords In Text
2,95844 gold badges3030 silver badges5555 bronze badges
Don't use grep. Download Silver Searcher or ripgrep. They're both outstanding, and way faster than grep or ack with tons of options.
AAAfarmclubAAAfarmclub
Word Search On A Mac
Not the answer you're looking for? Browse other questions tagged grep or ask your own question.
How To Search All Text On Mac For A Keywords
There absolutely needs to be a way to jump to a specific conversation position - it's next to useless having the phone jump to the end of the conversation - typically iPhones have a few long conversations stored (often requiring 100 or more taps of the 'load more messages' button to scroll all the way through) rather than a lot of short ones. Searching a specific keyword returns specific results, so obviously the phone is capable of locating a specific position in the conversation - there just isn't a button to jump to it, as OP noted. If the queried text is behind the first 'load more messages' wall, when you click the search result you just get taken to the end of the conversation♿. It basically teases you, telling you 'yes, I can locate the text you want, but no, I won't take you to it'.