If you want to search for a text string within the document itself, click the first pop-up menu in a row, choose Contents, and then type the string to match in the box. To add the file type, type the extension in the “Add New Extension to List” box and then click the “Add” button. By default, Windows Search will use a plain text filter to search the contents of those types of files, since another app is not associated. Use Mac OS X Spotlight search to find missing files The first point of call for many people is to open Spotlight and look for the file: Press Command-Space to open Spotlight. To quickly find any text string within any text file, try this from a terminal window: grep -l [text to find] [files to look in] For example, grep -l 123abc *.html will list the name of any file in the current directory that ends in.html and contains the string 123abc.
You can save a file to a location on your computer, like a hard disk drive or a flash drive, or on an online service, like OneDrive. You can also export files to different file formats and save them to different file names.
Important: Even if you have AutoRecover enabled, you should save a file frequently while you are working on it to avoid losing data due to an unexpected power failure or some other problem. AutoRecover is described later in the topic 'Save AutoRecover information automatically.'
When you save a file, you can usually change its name, storage location, and file format all at the same time, if you want to do so. However, you might not want to do all of those things, and the instructions in this topic describe each option individually.
Newer versionsOffice 2011
Save a file
By default, Office saves a file in a default working folder.
Related tasksSave as a different file name
To save the document that you currently have open to a new or different file name than it currently has, use Save as.
Save to a different location on your computer
If you want to save a file to a location on your computer other than the default folder, use Save as.
Save to a different location on an online service
Office allows you to save files in online folders provided by OneDrive and SharePoint. If you have accounts that give you access to these services, you can save and access files stored on these services much like files stored on your computer.
SharePoint services and OneDrive for Business are typically offered by an employer or organization, but you can use OneDrive on your own. For more information about these services, see the related topics in See Also.
To save a file to an online location other than the default folder, use Save as. You can save files from Word, Excel, or PowerPoint directly to folders on OneDrive and SharePoint services.
Save as a different format
If you need to share a file with someone who does not have Office for Mac or who has an older version, you can save your document in a file format that a different or older application can read. You can also export a document as a PDF file or an HTML file, among other choices.
Save AutoRecover information automatically
AutoRecover can help you recover a file that you were editing after a power failure or other problem that interrupts you while you are editing the file. The more frequently that AutoRecover saves files information, the more complete recovery can be after a failure.
However, using AutoRecover does not replace saving your files at regular intervals or when you are done editing the file. You may also find it helpful to save multiple versions of a file to different file names (for example, after each significant change) so that you can review or return to an earlier version, if necessary.
If after a failure, you choose not to save the recovered version of a file after you open it, the file is deleted, and your unsaved changes are lost. If you save the recovery file, it replaces the original file, unless you specify a new file name.
Save a file
By default, Office saves a file in a default working folder.
Related tasksSave as a different file name or to a different location on your computer
To save the document that you currently have open to a new or different file name than it currently has, use Save as.
Save to a different location on an online service
Office allows you to save files in online folders provided by OneDrive and SharePoint. If you have accounts that give you access to these services, you can save and access files stored on these services much like files stored on your computer.
SharePoint services and OneDrive for Business are typically offered by an employer or organization, but you can use OneDrive on your own. For more information about these services, see the related topics.
To save a file to an online location other than the default folder, use Share. You can save files from Word, Excel, or PowerPoint directly to folders on OneDrive and SharePoint services.
Note: If you're having trouble saving to an online location, make sure you're connected to the Internet and that you are signed in to either SharePoint or OneDrive. If you're on a corporate network, verify that your network connection is working.
Save to OneDrive
Save to SharePoint
Search For Text In Folder Of /documents/mackeeper Backups
Save as a different file format
When you create and save a workbook, Word, Excel, and PowerPoint automatically save the file in the Open XML format. However, you can save the file in another format or change the default file format.
Save a file in the Open XML Format (the default file format for Office for Mac 2011)
Save a file in the Office 2004 for Mac file format
Important: Some items that were created by using features in Office for Mac 2011 might behave differently when the document is saved in the file format that is used by Office 2004 for Mac or earlier. Use the Compatibility Report to avoid using new Office features that might behave differently with earlier versions of Office.
Save a file as PDF
You can save your document as PDF, to preserve document formatting and make the document readable but not editable. You need to use Adobe Reader to view documents after you save them in this file format.
Note: PDF files created from Office 2011 are limited to printable content. In other words, if the content does not appear in print, it will not appear in the PDF.
Change the default file format that files are saved in
You can change the file format that Office for Mac always saves documents in. For example, if you usually share documents with other people who use an earlier version of Office for Mac, you might want to always save documents in the file format that is used in that version.
In Word and PowerPoint:
In Excel:
Save a file as a webpage (Word and Excel only)
You can save a file as a webpage, which converts the file into a file format that's readable by web browsers. However, the results of the conversion depend on the kind of content in your file. Office for Mac converts the file's formatting to the closest equivalent web formatting. Therefore, the webpage might look very different from the original file. For example, many text effects, such as animated, embossed, or outlined text, become plain or shaded text.
Note: We recommend that you preview the file in a web browser to make sure that the results are what you want. To do this, on the File menu, click Web Page Preview.
Save a file as plain text (Word only)
You can save a document as plain text so that the document can be opened by a number of text editing programs. However, saving a document in plain text does not reliably preserve the formatting, layout, or other features of the document.
Save a file as JPEG (PowerPoint only)
When you save a presentation as a JPEG, each slide becomes a picture. Then, if you post the presentation on a Web site, the presentation is easier to view.
Save a file as a movie (PowerPoint only)
To run your presentation on a computer that doesn't have PowerPoint installed, you can save your presentation as a movie (.mov) file. You can then play the movie in any application that supports QuickTime movies.
Save AutoRecover information automatically
AutoRecover can help you recover a file that you were editing after a power failure or other problem that interrupts you while you are editing the file. The more frequently that AutoRecover saves files information, the more complete recovery can be after a failure.
However, using AutoRecover does not replace saving your files at regular intervals or when you are done editing the file. You may also find it helpful to save multiple versions of a file to different file names (for example, after each significant change) so that you can review or return to an earlier version, if necessary.
If after a failure, you choose not to save the recovered version of a file after you open it, the file is deleted, and your unsaved changes are lost. If you save the recovery file, it replaces the original file, unless you specify a new file name.
Create a document for use with earlier versions of Word
When you open a document in Word for Mac 2011 that was created in an earlier version of Word, either Word for Mac or Word for Windows, compatibility mode is turned on. [Compatibility Mode] shows in the title bar of the document window. Compatibility mode indicates that the document was created in an earlier version of Word or was saved in an earlier file format. In compatibility mode, no new or improved features in Word 2011 are available. However, users can still edit the document by using features that are compatible with the earlier file format.
You can work in compatibility mode or you can convert your document to the Word 2011 file format. When you save in the Word 2011 format, the document layout appears as if it were created in Word 2011 and the file format changes from .doc to .docx. In this format, you can access the new and improved features in Word 2011. However, anyone who uses an earlier version of Word may be prevented from or have problems editing parts of the document that were created by using new or enhanced features.
Document elements that behave differently in compatibility mode
The elements listed in the following table might change permanently when you work in compatibility mode. You can't convert them back to Word 2011 elements even if you convert your document to Word 2011 later.
The document elements listed in the following table change when you work in compatibility mode. However, you can convert them to Word 2011 elements if you convert your document to Word 2011 later.
Turn on compatibility mode
You can create new documents that are compatible with earlier versions of Word by using compatibility mode.
Convert a document from compatibility mode
The Convert Document command clears the compatibility options so that the document layout appears as if it were created in Word 2011. If the file is in .doc format, the Convert Document command also upgrades the file to the .docx format. After you convert the document, you can access the new and enhanced features in Word 2011. However, people who are using earlier versions of Word may be prevented from or have problems editing certain parts of the document that were created by using new or enhanced features in Word 2011.
See also
It's fast, it's powerful, and its very name suggests that it does something technical: grep. With this workhorse of the command line, you can quickly find text hidden in your files. Understanding grep is the first step in joining the guild of command-line wizards.
Why Not Use the Finder?
It's easy to find files with the Finder when you know their names. But the grep command is a time-saver when you're trying to find what's inside files. You can use grep easily from the command line to search for specific text, and you'll get results in seconds. (You can also use grep within certain text editors.)
The Finder offers a similar function: the Find By Content search. (Press Command-F in the Finder, select Content in the Search For Items Whose pop-up menu, and enter a search string in the text field.) But the Finder searches only inside files it has indexed, and it ignores hidden system files unless you expressly choose to search for visible and invisible files and add your System folder to the search.
The Finder also lacks grep's flexibility: while it's good for searching for a specific word (for example, Walden ), it becomes less useful when you want to find a longer string. Search for Walden Pond, and it returns all files that contain either Walden or Pond.
Using grep also gives you access to regular expressions. These combinations of letters, numbers, wild cards, and other special characters let you find much more than mere words. You can search for just about any string of characters: IP addresses in log files; phone numbers in contact lists; or specific strings containing a series of numbers, letters, or other characters. Using regular expressions, you're limited only by your imagination.
Get a Grip on Grep
The grep command looks inside one or several files for the string, or text, you specify. Its syntax is:
grep options search_string file.. .
At its most basic, you tell grep what to look for and where:
grep AppleTalk /etc/services , for example. Here, you tell grep to look for AppleTalk in the services file located in the /etc directory. (This useful file contains a list of network port numbers for commonly used services.) The command displays each line that contains your search string:
And so on. You can use the familiar asterisk (
* ) wild card to have grep search a group of files in the current working directory, as in grep Walden * . This command searches all the files in the current directory for the word Walden, returning the following:
![]()
And so on. As the above example shows, the search returns several matches. The first, Walden.doc, is a Word file. The grep command calls such proprietary file types binary files. It can't display the contents of binary files, but it can search inside them and tell you if something matches. The next examples come from plain-text files, for which grep can display the results. You see the file name, followed by a match of the search string in its context.
You can search for any multiword text string by enclosing the string in single quotes. For example, if you want to search for the phrase Walden Pond,you'd type
grep 'Walden Pond' * .
Note that grep doesn't like Macintosh line breaks. It returns lines containing the search string, but it doesn't see Mac line breaks as anything other than characters. In such a case, the “line” it returns is the entire file; this can dump a lot of text into your Terminal window.
In the previous example, grep ran in a specific folder, checking all the files it contained. What if you want to run grep on a folder and its subfolders, or you want grep to look for the string regardless of case? You need to add options. For example, to search for Waldenanywhere in a folder or its subfolders, use the
-r (recursive) option: grep -r Walden ~/Documents/* .
Fine-Tune Your Searches
The grep command has several options that let you fine-tune the way you search for text, as well as the kind of results grep returns. Get started with the helpful options listed here. (Note that you can also combine options—for instance,
grep -rl Walden searches subfolders and returns only a list of files containing the word Walden .)
Search for Multiple Strings
Using the pipe (
| ), a Unix redirection operator, you can tell grep to search for more than one string. Say you want to find files containing both Walden and Pondon the same line. You'd use this command: grep Walden * | grep Pond . The first part of the command looks for the word Walden in any files in the current directory, and the second runs another grep command on the results of the first command. Terminal displays only the final results of the two commands combined.
You could string together many grep commands, like this:
. This command looks in a special dictionary file for words containing the lowercase letter a. It then looks for words containing e in the results, and so on, finally returning only those words that contain all five vowels.
This function of grep is most useful when you're searching for specific strings in output from other commands. In this way you can whittle down long and complex output. For example, here's a common way to find the process ID of a program that's stuck so you can force-quit it from the command line: type
ps -ax | grep Finder .
This command first gets a list of all processes running on your Mac, and then sifts through this list looking for lines containing the word Finder. For example, your results might be as follows:
The process ID is the first number on each line; here, the Finder is 390. (You'll notice the command also returns itself; since the word Finderis in the grep command, that gets listed as well.) So if the Finder is stuck, this gives you the information you need to force-quit it. Now you would type the command (where the process ID is the final argument)
kill -9 390 .
Add Regular Expressions to the Mix
While you have seen some of the power of the grep command, you can go much further using regular expressions, special combinations of characters that act as wild cards. Here are a few examples.
If you're not sure how to spell the word separate, for example (is that an a or an e?), run this command to check the special dictionary file hidden in your Mac's entrails:
You'll get back a list of words that includes separate, separately, separately, separateness, and separates.
Search For Text In Folder Of Documents Mac Book
Note the two special characters in the command: the caret (
^ ) and the dot (. ). The caret tells grep to search for the string at the beginning of a line, so the results don't include words like inseparate. The dot matches any character except a new line.
What if you want to find all the phone numbers in a specific file? Try this command, which will find phone numbers in the 555-1234 format:
.
Each of the
[0-9] wild cards matches any character in the range specified in brackets. You can use ranges such as[1-3] to limit your search to specific strings. This works for letters, too:[a-n] matches any lowercase character from a to n.You can build your own range with sets of characters—for example, [aeiou] will match only vowels. You can learn more about regular expressions by typingman grep in Terminal, or by consulting Jeffrey Friedl's excellent book Mastering Regular Expressions, second edition (O'Reilly, 2002). With a bit of practice, you'll be using grep and regular expressions to find anything you want.
Kirk McElhearn is the author of The Mac OS X Command Line: Unix Under the Hood (Sybex, 2004). His blog, Kirkville, has articles and tips on using the command line with Mac OS X. ]
Grep Text In Folder
Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |