• Home

Search For Words In Text On Mac

 

You can search in Google Docs for a word or specific characters, and choose to find and replace the chosen text in the document. You can also use keyboard shortcuts on a Mac or PC to search in. The most common ways to search an entire Mac with Spotlight are either through the menu bar item—the magnifying glass, which you can activate by typing Command-Space—or by searching in a. Curved Text Is Ms Word For Mac Mac Keys For Excel Text Wrap How To Center Text In Word For Mac 2008 Text Pad For Mac Slime Speech To Text For Mac The Best Text To Speech Software For Mac For Free Outlook For Mac Rich Text Signature Autocapitalize On Mac For Text Best Plain Text Editor For Ios Mac And Windows 2017. Find and replace text in Pages on Mac You can search for specific words, phrases, numbers, and characters, and automatically replace search results with new content that you specify.


Search for text in multiple Word files via the Terminal 11 comments Create New Account
Click here to return to the 'Search for text in multiple Word files via the Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Search for text in multiple Word files via the Terminal

Or add this alias to your tcsh aliases:
alias hgrep 'grep !* -Ir .'
use as in
hgrep foo
finds all instances of foo in non-binary files from here down in the hierarchy
In other words, grep supports recursion, so no need for the find
grep 'danny the dog' -li -r .
does the same thing as the hint.

Sorry if I've mentioned this before, but if you use the 'Z' shell (zsh) instead of

Search For Words In Documents

csh

Search For Words In Text On Mac

or bash, then you don't need to use the 'find' command, as it has inbuilt recursive filename completion. So you can get the same effect by simply typing
Text grep -li 'danny the dog' **/*.doc
Search You can also restrict by file size, type, permissions — everything find can do and more.

zsh has lots of other great features, too — and it's free, open source, and supplied as part of Mac OS X. (I'm surprised it's not more popular.)

---
Andy/

great! I've been using zsh for years (and fully agree it's a terrific shell), was aware of the '**' feature but it never occured to me that it could be used to replace the rather clumsy find/grep combination. Thanks!
Let me also add that for those who are versed in regular expressions, egrep should be used in place of grep (as far as i understood).
Search for text in multiple Word files via the Terminal
find doesn't operate from the current directory down. The first argument to find is the directory to start from, and '.' is the current directory. There's no need to cd elsewhere, you just change the first argument, eg
Search for text in multiple Word files via the Terminal
find doesn't handle spaces well. A command I often execute and have aliased is:
find . -type f -print0 xargs -0 egrep (your pattern here)
The -print0 and the -0 argument to xargs cause the two tools to use zero-bytes to terminate file names instead of newlines, since the shell doesn't discriminate between newlines and other whitespace in many cases. This means it will handle folders and files with spaces, tabs and other strange characters in their name.
Search for text in multiple Word files via the Terminal

In response to the parenthetical comment, you don't need Tiger to do this now. You just need to open up the 'Find' window in the Finder, select your home directory as the target of the search (likely already available in your selected places list), add 'doc' to the extension criterion, then add the words in the content criterion. Nowhere near as fast as Tiger promises, but the find dialog window is largely keyboard-navigable, so you can save yourself a trip to Terminal.

grep -r reads every file looking for the string, even in non .doc files > very slow !
As for the finder, it is enable to search inside word documents (at least for the moment, didn't know it was a tiger feature).

Search for text in multiple Word files via the Terminal

Once you find what you're looking for you might then want to change the sought after text to something else. Say all instances of 'dog' to 'cat' as one example..
find . -type f -name '*.doc' xargs -n1 perl -p -i -e 's/dog/cat/g'
the perl code will edit in place and make a backup of the original file being edited at the time. All instances of 'dog' will now be 'cat'. Very handy..

Search text in word document
It is faster to use find(1) with xargs(1), but then the syntax is a little more complicated. Here is a script that reduces the syntax to a bare minimum for the most common usage - i.e., finding files containing strings. To use it, copy the text below and save it (e.g., with TextEdit) to a file named `pat' in your current path (.e.g., /usr/bin/pat or preferably someplace like /opt/bin/pat, if that's in your path). Examples of how the command is used are contained in the comments of the script itself. Don't forget to make the script executable, e.g., with the command line: ---- CUT HERE ----

Thanks so much! I was looking for a 'UNIX' way to do this for some time.

Search For Words In Text On Mac
Search for text in multiple Word files via the Terminal

Upgrade paint for windows. This is very helpful. Too bad that you can't do it in finder or, better yet, in word 2004

Search Text In Word Document

Hi I'm new here and I'm happy to be the proud owner of my first MAC computer. Loving it so far but I need to get used to some functions available to a normal PC.
Can anyone telll me if it's possible to search for spefic words within a document or website. E.g. when I search for specific items in a search engine and the websites come up, I want to be able to search for the words when I click on the search engine results. Previously for windows PC I will press the 'Control-F' function and they will search and highlight the words that come up.
Can anynoe let me know if MAC provides this function as well?
Cheers